summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-05-11 10:56:22 -0700
committerGitHub <noreply@github.com>2022-05-11 10:56:22 -0700
commitbad3f9e8f058cfdaefb3d7d76a93e842665f8435 (patch)
tree840eb9c70df3b3475eb18f662d2375a9eda230f9 /test
parente209fcbc3fc66db775ec65d85dbd64a6069c1681 (diff)
downloadbinaryen-bad3f9e8f058cfdaefb3d7d76a93e842665f8435.tar.gz
binaryen-bad3f9e8f058cfdaefb3d7d76a93e842665f8435.tar.bz2
binaryen-bad3f9e8f058cfdaefb3d7d76a93e842665f8435.zip
[NominalFuzzing] Fix SignaturePruning on types with a super (#4657)
Do not prune parameters if there is a supertype that is a signature. Without this we crash on an assertion in TypeBuilder when we try to recreate the types (as we try to make a a subtype with fewer fields than the super).
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/signature-refining.wast18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lit/passes/signature-refining.wast b/test/lit/passes/signature-refining.wast
index c67e04917..19558d997 100644
--- a/test/lit/passes/signature-refining.wast
+++ b/test/lit/passes/signature-refining.wast
@@ -656,3 +656,21 @@
)
)
)
+
+(module
+ ;; CHECK: (type $A (func_subtype (param i32) func))
+ (type $A (func_subtype (param i32) func))
+ ;; CHECK: (type $B (func_subtype (param i32) $A))
+ (type $B (func_subtype (param i32) $A))
+
+ ;; CHECK: (func $bar (type $B) (param $x i32)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
+ (func $bar (type $B) (param $x i32)
+ ;; The parameter to this function can be pruned. But while doing so we must
+ ;; properly preserve the subtyping of $B from $A, which means we cannot just
+ ;; remove it - we'd need to remove it from $A as well, which we don't
+ ;; attempt to do in the pass atm. So we do not optimize here.
+ (nop)
+ )
+)