diff options
author | Alon Zakai <azakai@google.com> | 2022-11-29 09:21:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 09:21:01 -0800 |
commit | 17a698807c5b898abe9b1c98eab5f3f89bc1c877 (patch) | |
tree | 9e7dd7d67fe1cc62ac619780576b137bb371fcfe /src | |
parent | ece1da725bd798c205b85518e6bc5fd0d0140240 (diff) | |
download | binaryen-17a698807c5b898abe9b1c98eab5f3f89bc1c877.tar.gz binaryen-17a698807c5b898abe9b1c98eab5f3f89bc1c877.tar.bz2 binaryen-17a698807c5b898abe9b1c98eab5f3f89bc1c877.zip |
Validator: Print the field number on subtyping errors (#5297)
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 393d28c1e..7a4bb6a97 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2586,10 +2586,12 @@ void FunctionValidator::visitStructNew(StructNew* curr) { "struct.new must have the right number of operands")) { // All the fields must have the proper type. for (Index i = 0; i < fields.size(); i++) { - shouldBeSubType(curr->operands[i]->type, - fields[i].type, - curr, - "struct.new operand must have proper type"); + if (!Type::isSubType(curr->operands[i]->type, fields[i].type)) { + info.fail("struct.new operand " + std::to_string(i) + + " must have proper type", + curr, + getFunction()); + } } } } |