From 7044da7fe6754c54bd7f4930eaa208e3081cabe3 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 28 Sep 2022 11:30:56 -0700 Subject: [GUFA] Fix haveIntersection on comparing nullable with non-nullable (#5089) We compared types and not heap types, so a difference in nullability confused us. But at that point in the code, we've ruled out nulls, so we should focus on heap types only. --- test/gtest/possible-contents.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/gtest/possible-contents.cpp') diff --git a/test/gtest/possible-contents.cpp b/test/gtest/possible-contents.cpp index 1e1f0e5c9..933e220bb 100644 --- a/test/gtest/possible-contents.cpp +++ b/test/gtest/possible-contents.cpp @@ -280,9 +280,16 @@ TEST_F(PossibleContentsTest, TestIntersection) { assertHaveIntersection(exactFuncSignatureType, exactFuncSignatureType); assertHaveIntersection(i32Zero, i32One); // TODO: this could be inferred false + // Exact types only differing by nullability can intersect (not on the null, + // but on something else). + assertHaveIntersection(exactAnyref, exactNonNullAnyref); + // Due to subtyping, an intersection might exist. assertHaveIntersection(funcGlobal, funcGlobal); assertHaveIntersection(funcGlobal, exactFuncSignatureType); + assertHaveIntersection(nonNullFuncGlobal, exactFuncSignatureType); + assertHaveIntersection(funcGlobal, exactNonNullFuncSignatureType); + assertHaveIntersection(nonNullFuncGlobal, exactNonNullFuncSignatureType); // Neither is a subtype of the other, but nulls are possible, so a null can be // the intersection. -- cgit v1.2.3