diff options
author | Alon Zakai <azakai@google.com> | 2021-03-02 23:41:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 15:41:16 -0800 |
commit | 5f88277c4bddc097d2f073e41488889f02b08103 (patch) | |
tree | d669c7c77f9945f696930c3b29c7d67a21a5d274 /src/wasm/wasm-binary.cpp | |
parent | e7c6356c7529c29ef06f4541bc3164659e8917f6 (diff) | |
download | binaryen-5f88277c4bddc097d2f073e41488889f02b08103.tar.gz binaryen-5f88277c4bddc097d2f073e41488889f02b08103.tar.bz2 binaryen-5f88277c4bddc097d2f073e41488889f02b08103.zip |
[Wasm GC] Allow subtyping in arguments to struct.get etc. Fixes #3636 (#3644)
Note that Binaryen "canonicalizes" the type, so in the test output here
we end up with $grandchild twice. This is a consequence of us not
storing the heap type as an extra field. I can't think of a downside to
this canonicalization, aside from losing perfect roundtripping, but I think
that's a worthwhile tradeoff for efficiency as we've been thinking so far.
Fixes #3636
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 1f54a0038..d5579eedf 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -6417,7 +6417,7 @@ void WasmBinaryBuilder::validateHeapTypeUsingChild(Expression* child, return; } if ((!child->type.isRef() && !child->type.isRtt()) || - child->type.getHeapType() != heapType) { + !HeapType::isSubType(child->type.getHeapType(), heapType)) { throwError("bad heap type: expected " + heapType.toString() + " but found " + child->type.toString()); } |