diff options
author | Alon Zakai <azakai@google.com> | 2021-07-28 13:54:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-28 13:54:29 -0700 |
commit | 1ed257a587a30885f42f2c1b6170d662e741ae40 (patch) | |
tree | ad6cce346ea5a620b47944f5270b0fe7bba454a1 /src/tools/execution-results.h | |
parent | c5166f636c5835413046be76e26c362ef4bbecc5 (diff) | |
download | binaryen-1ed257a587a30885f42f2c1b6170d662e741ae40.tar.gz binaryen-1ed257a587a30885f42f2c1b6170d662e741ae40.tar.bz2 binaryen-1ed257a587a30885f42f2c1b6170d662e741ae40.zip |
[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.
Diffstat (limited to 'src/tools/execution-results.h')
-rw-r--r-- | src/tools/execution-results.h | 4 |
1 files changed, 3 insertions, 1 deletions
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; } |