summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Winstein <keithw@cs.stanford.edu>2023-08-23 13:49:40 -0700
committerGitHub <noreply@github.com>2023-08-23 20:49:40 +0000
commitba73887a5abf5bb40b564a55a61d3970d1e394f6 (patch)
tree20d797e80d810c451f34098f9e90bd44db4757d1
parent7eb5868cf0c37c2fe800fa92017fc063bc8fb991 (diff)
downloadwabt-ba73887a5abf5bb40b564a55a61d3970d1e394f6.tar.gz
wabt-ba73887a5abf5bb40b564a55a61d3970d1e394f6.tar.bz2
wabt-ba73887a5abf5bb40b564a55a61d3970d1e394f6.zip
Validator: normalize handling of Select in ExprVisitor Delegate (#2285)
Fixes #2283 Previously, the OnSelectExpr delegate would terminate validation if the SharedValidator found an error in the expression, or if the Validator had previously found an error at any point in validating the module. This commit normalizes the behavior to match how the Validator handles other expression types.
-rw-r--r--src/validator.cc5
-rw-r--r--test/parse/expr/bad-select-multi.txt3
-rw-r--r--test/typecheck/bad-select-value0.txt3
-rw-r--r--test/typecheck/bad-select-value1.txt3
4 files changed, 0 insertions, 14 deletions
diff --git a/src/validator.cc b/src/validator.cc
index ade15462..d52efb97 100644
--- a/src/validator.cc
+++ b/src/validator.cc
@@ -524,12 +524,7 @@ Result Validator::OnReturnCallIndirectExpr(ReturnCallIndirectExpr* expr) {
Result Validator::OnSelectExpr(SelectExpr* expr) {
result_ |= validator_.OnSelect(expr->loc, expr->result_type.size(),
expr->result_type.data());
- // TODO: Existing behavior fails when select fails.
-#if 0
return Result::Ok;
-#else
- return result_;
-#endif
}
Result Validator::OnStoreExpr(StoreExpr* expr) {
diff --git a/test/parse/expr/bad-select-multi.txt b/test/parse/expr/bad-select-multi.txt
index e14eb9c2..4c53e30f 100644
--- a/test/parse/expr/bad-select-multi.txt
+++ b/test/parse/expr/bad-select-multi.txt
@@ -14,7 +14,4 @@
out/test/parse/expr/bad-select-multi.txt:10:5: error: invalid arity in select instruction: 2.
select (result i32 i32)
^^^^^^
-out/test/parse/expr/bad-select-multi.txt:11:5: error: type mismatch at end of function, expected [] but got [... i32, i32, i32, i32]
- unreachable
- ^^^^^^^^^^^
;;; STDERR ;;)
diff --git a/test/typecheck/bad-select-value0.txt b/test/typecheck/bad-select-value0.txt
index 1fc29dbb..b2833d03 100644
--- a/test/typecheck/bad-select-value0.txt
+++ b/test/typecheck/bad-select-value0.txt
@@ -11,7 +11,4 @@
out/test/typecheck/bad-select-value0.txt:8:5: error: type mismatch in select, expected [f64, f64, i32] but got [i32, f64, f32]
select
^^^^^^
-out/test/typecheck/bad-select-value0.txt:9:5: error: type mismatch at end of function, expected [] but got [f64]
- drop))
- ^^^^
;;; STDERR ;;)
diff --git a/test/typecheck/bad-select-value1.txt b/test/typecheck/bad-select-value1.txt
index 4660eee4..7bb2447d 100644
--- a/test/typecheck/bad-select-value1.txt
+++ b/test/typecheck/bad-select-value1.txt
@@ -11,7 +11,4 @@
out/test/typecheck/bad-select-value1.txt:8:5: error: type mismatch in select, expected [i64, i64, i32] but got [i32, i64, f32]
select
^^^^^^
-out/test/typecheck/bad-select-value1.txt:9:5: error: type mismatch at end of function, expected [] but got [i64]
- drop))
- ^^^^
;;; STDERR ;;)