summaryrefslogtreecommitdiff
path: root/test/gtest/possible-contents.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/gtest/possible-contents.cpp')
-rw-r--r--test/gtest/possible-contents.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/gtest/possible-contents.cpp b/test/gtest/possible-contents.cpp
index c6b7d000c..dc10c00bf 100644
--- a/test/gtest/possible-contents.cpp
+++ b/test/gtest/possible-contents.cpp
@@ -787,18 +787,28 @@ TEST_F(PossibleContentsTest, TestStructCones) {
PossibleContents::fullConeType(nnD),
none);
- // Globals stay as globals if their type is in the cone. Otherwise, they lose
- // the global info and we compute a normal cone intersection on them. The
- // same for literals.
+ // Globals stay as globals, but their type might get refined.
assertIntersection(
funcGlobal, PossibleContents::fullConeType(funcref), funcGlobal);
+ // No global filtering.
auto signature = Type(Signature(Type::none, Type::none), Nullable);
assertIntersection(
nonNullFunc, PossibleContents::fullConeType(signature), nonNullFunc);
+
+ // Filter a global to a more specific type.
assertIntersection(funcGlobal,
PossibleContents::fullConeType(signature),
- PossibleContents::fullConeType(signature));
+ PossibleContents::global("funcGlobal", signature));
+
+ // Filter a global's nullability only.
+ auto nonNullFuncRef = Type(HeapType::func, NonNullable);
+ assertIntersection(funcGlobal,
+ PossibleContents::fullConeType(nonNullFuncRef),
+ nonNullFuncGlobal);
+
+ // Incompatible global and cone types have no intersection.
+ assertIntersection(funcGlobal, PossibleContents::fullConeType(nullE), none);
// Incompatible hierarchies have no intersection.
assertIntersection(