summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/nominal-func.wast28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/lit/nominal-func.wast b/test/lit/nominal-func.wast
new file mode 100644
index 000000000..b4f0a2f15
--- /dev/null
+++ b/test/lit/nominal-func.wast
@@ -0,0 +1,28 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+;; RUN: wasm-opt %s -all --nominal -S -o - | filecheck %s
+
+;; TODO: Preserve function heap types through round tripping as well.
+;; RUNX: wasm-opt %s -all --nominal --roundtrip -S -o - | filecheck %s
+
+(module
+ ;; This will be the "canonical" function type rather than $foo_t
+ (type $bad_t (func))
+
+ (type $foo_t (func))
+ (type $struct (struct (ref $foo_t)))
+
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ (func $foo (type $foo_t)
+ (unreachable)
+ )
+
+ ;; $foo needs to be assigned type foo_t rather than bad_t for this to validate.
+ ;; CHECK: (func $make-ref (result (ref $foo_t))
+ ;; CHECK-NEXT: (ref.func $foo)
+ ;; CHECK-NEXT: )
+ (func $make-ref (result (ref $foo_t))
+ (ref.func $foo)
+ )
+)