From 1ed257a587a30885f42f2c1b6170d662e741ae40 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 28 Jul 2021 13:54:29 -0700 Subject: [Wasm GC] Handle uses of default values in LocalSubtyping (#4024) It is ok to use the default value of a reference even if we refine the type, as it would be a more specifically-typed null, and all nulls compare the same. However, if the default is used then we *cannot* alter the type to be non-nullable, as then we'd use a null where that is not allowed. --- src/tools/execution-results.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/tools/execution-results.h') diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index aabbb4819..8fc4c2eed 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -144,7 +144,9 @@ struct ExecutionResults { } bool areEqual(Literal a, Literal b) { - if (a.type != b.type) { + // We allow nulls to have different types (as they compare equal regardless) + // but anything else must have an identical type. + if (a.type != b.type && !(a.isNull() && b.isNull())) { std::cout << "types not identical! " << a << " != " << b << '\n'; return false; } -- cgit v1.2.3