summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-09 11:57:23 -0800
committerGitHub <noreply@github.com>2021-03-09 11:57:23 -0800
commita1d3e63f89e9d13daabf626033a66fe5b8a8bce1 (patch)
tree9aabb7bdfa5645c31323ffea2051db7f3645653d /src
parentafc5fbd51759c07492fec4cae86d7e9484547626 (diff)
downloadbinaryen-a1d3e63f89e9d13daabf626033a66fe5b8a8bce1.tar.gz
binaryen-a1d3e63f89e9d13daabf626033a66fe5b8a8bce1.tar.bz2
binaryen-a1d3e63f89e9d13daabf626033a66fe5b8a8bce1.zip
[Wasm GC] Allow set values to be subtypes (#3665)
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-validator.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 656c5e832..70a9ad90f 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -2423,10 +2423,10 @@ void FunctionValidator::visitStructSet(StructSet* curr) {
const auto& fields = curr->ref->type.getHeapType().getStruct().fields;
shouldBeTrue(curr->index < fields.size(), curr, "bad struct.get field");
auto& field = fields[curr->index];
- shouldBeEqual(curr->value->type,
- field.type,
- curr,
- "struct.set must have the proper type");
+ shouldBeSubType(curr->value->type,
+ field.type,
+ curr,
+ "struct.set must have the proper type");
shouldBeEqual(
field.mutable_, Mutable, curr, "struct.set field must be mutable");
}
@@ -2494,10 +2494,10 @@ void FunctionValidator::visitArraySet(ArraySet* curr) {
return;
}
const auto& element = curr->ref->type.getHeapType().getArray().element;
- shouldBeEqual(curr->value->type,
- element.type,
- curr,
- "array.set must have the proper type");
+ shouldBeSubType(curr->value->type,
+ element.type,
+ curr,
+ "array.set must have the proper type");
shouldBeTrue(element.mutable_, curr, "array.set type must be mutable");
}