diff options
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 68fb58ec4..bec9b0ad0 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2535,11 +2535,11 @@ void FunctionValidator::visitRefCast(RefCast* curr) { curr, "ref.cast target type and ref type must have a common supertype"); - // TODO: Remove this restriction - shouldBeEqual(curr->type.getNullability(), - curr->ref->type.getNullability(), - curr, - "ref.cast to a different nullability not yet implemented"); + // We should never have a nullable cast of a non-nullable reference, since + // that unnecessarily loses type information. + shouldBeTrue(curr->ref->type.isNullable() || curr->type.isNonNullable(), + curr, + "ref.cast null of non-nullable references are not allowed"); } void FunctionValidator::visitBrOn(BrOn* curr) { |