summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gtest/possible-contents.cpp7
-rw-r--r--test/lit/passes/gufa-refs.wast11
2 files changed, 18 insertions, 0 deletions
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.
diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast
index 24ebda381..42f1b349d 100644
--- a/test/lit/passes/gufa-refs.wast
+++ b/test/lit/passes/gufa-refs.wast
@@ -2766,6 +2766,9 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $ref.eq-zero (export "ref.eq-zero")
;; We do not track specific references, so only the types can be used here.
@@ -2791,6 +2794,14 @@
)
)
)
+ (drop
+ (ref.eq
+ (struct.new $struct
+ (i32.const 5)
+ )
+ (ref.null $struct)
+ )
+ )
)
;; CHECK: (func $ref.eq-unknown (type $i32_ref?|$struct|_ref?|$struct|_ref?|$other|_ref|$struct|_ref|$struct|_ref|$other|_=>_none) (param $x i32) (param $struct (ref null $struct)) (param $struct2 (ref null $struct)) (param $other (ref null $other)) (param $nn-struct (ref $struct)) (param $nn-struct2 (ref $struct)) (param $nn-other (ref $other))