From 871bf6d1d76e8af3c51b47f77875dfe695904bbe Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 12 Oct 2022 08:14:21 -0700 Subject: [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. --- test/gtest/possible-contents.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') 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); -- cgit v1.2.3