From a1d3e63f89e9d13daabf626033a66fe5b8a8bce1 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 9 Mar 2021 11:57:23 -0800 Subject: [Wasm GC] Allow set values to be subtypes (#3665) --- src/wasm/wasm-validator.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/wasm/wasm-validator.cpp') 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"); } -- cgit v1.2.3