summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-03 19:53:26 +0000
committerGitHub <noreply@github.com>2021-03-03 11:53:26 -0800
commit11ec03ce930121736655769b9bbccaae0280b64c (patch)
tree969ca4dc33027f8054789103c908906f5c00cf6c /test
parenta5e5be42cf32e0232ef7a4c3bce67c289623eea6 (diff)
downloadbinaryen-11ec03ce930121736655769b9bbccaae0280b64c.tar.gz
binaryen-11ec03ce930121736655769b9bbccaae0280b64c.tar.bz2
binaryen-11ec03ce930121736655769b9bbccaae0280b64c.zip
[Wasm GC] Parse text field names even of types that end up canonicalized together (#3647)
Names of structurally identical types end up "collapsed" together after the types are canonicalized, but with this PR we can properly read content that has structurally identical types with different names.
Diffstat (limited to 'test')
-rw-r--r--test/heap-types.wast10
-rw-r--r--test/heap-types.wast.from-wast5
-rw-r--r--test/heap-types.wast.fromBinary5
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo5
4 files changed, 25 insertions, 0 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 84490d031..364d1b0a3 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -6,6 +6,13 @@
(field f32)
(field $named f64)
))
+ ;; identical to $struct.A, so will be canonicalized with it, but field names
+ ;; are different
+ (type $struct.A.prime (struct
+ i32
+ (field f32)
+ (field $othername f64)
+ ))
(type $struct.B (struct
(field i8)
(field (mut i16))
@@ -52,6 +59,9 @@
(struct.get $struct.A $named (local.get $x))
)
(drop
+ (struct.get $struct.A.prime $othername (ref.null $struct.A.prime))
+ )
+ (drop
(struct.get_u $struct.B 0 (local.get $tB))
)
(drop
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index d36e31ccb..5835ba7d9 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -52,6 +52,11 @@
)
)
(drop
+ (struct.get $struct.A $named
+ (ref.null $struct.A)
+ )
+ )
+ (drop
(struct.get_u $struct.B 0
(local.get $tB)
)
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 62590b5f7..90e129511 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -52,6 +52,11 @@
)
)
(drop
+ (struct.get $struct.A $named
+ (ref.null $struct.A)
+ )
+ )
+ (drop
(struct.get_u $struct.B 0
(local.get $tB)
)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 074f88ff8..e75ddbe26 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -52,6 +52,11 @@
)
)
(drop
+ (struct.get ${i32_f32_f64} 2
+ (ref.null ${i32_f32_f64})
+ )
+ )
+ (drop
(struct.get_u ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
(local.get $2)
)