diff options
author | Alon Zakai <azakai@google.com> | 2022-10-12 08:14:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 08:14:21 -0700 |
commit | 871bf6d1d76e8af3c51b47f77875dfe695904bbe (patch) | |
tree | 6c01fb9ae5aefaf530087c3d6c94aed81e44c140 /test | |
parent | 5129f8894bc8f197864a8f136cab191a2c9ea741 (diff) | |
download | binaryen-871bf6d1d76e8af3c51b47f77875dfe695904bbe.tar.gz binaryen-871bf6d1d76e8af3c51b47f77875dfe695904bbe.tar.bz2 binaryen-871bf6d1d76e8af3c51b47f77875dfe695904bbe.zip |
[Wasm GC] Fix the intersection of a bottom type null (#5128)
When the heap types are not subtypes of each other, but a null is possible, the
intersection exists and is a null. That null must be the shared bottom type.
Diffstat (limited to 'test')
-rw-r--r-- | test/gtest/possible-contents.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/gtest/possible-contents.cpp b/test/gtest/possible-contents.cpp index 04c288806..7b8f0c4a8 100644 --- a/test/gtest/possible-contents.cpp +++ b/test/gtest/possible-contents.cpp @@ -481,6 +481,8 @@ void assertIntersection(PossibleContents a, auto intersection = a; intersection.intersectWithFullCone(b); EXPECT_EQ(intersection, result); + + EXPECT_EQ(PossibleContents::haveIntersection(a, b), !result.isNone()); } TEST_F(PossibleContentsTest, TestStructCones) { @@ -713,6 +715,13 @@ TEST_F(PossibleContentsTest, TestStructCones) { assertIntersection(nnExactA, PossibleContents::fullConeType(nullB), none); assertIntersection(exactA, PossibleContents::fullConeType(nnB), none); + // A and E have no intersection, so the only possibility is a null, and that + // null must be the bottom type. + assertIntersection( + exactA, + PossibleContents::fullConeType(nullE), + PossibleContents::literal(Literal::makeNull(HeapType::none))); + assertIntersection(PossibleContents::coneType(nnA, 1), PossibleContents::fullConeType(nnB), nnExactB); |