diff options
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 604854878..cf71689b1 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -945,10 +945,10 @@ void RefTest::finalize() { void RefCast::finalize() { if (ref->type == Type::unreachable) { type = Type::unreachable; - } else { - // The output of ref.cast may be null if the input is null (in that case the - // null is passed through). - type = Type(intendedType, ref->type.getNullability()); + } + // Do not unnecessarily lose non-nullability information. + if (ref->type.isNonNullable() && type.isNullable()) { + type = Type(type.getHeapType(), NonNullable); } } |