summaryrefslogtreecommitdiff
path: root/test/regress
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2018-10-30 16:19:26 -0700
committerGitHub <noreply@github.com>2018-10-30 16:19:26 -0700
commit39ceee53a9cd23451a28d4e56e151ef76044b5df (patch)
tree6e66cd1c5cc6bb3729a93685e450181fefbb2897 /test/regress
parentbba180a8c1ea170341e8479ba6ceebeb7b97cf73 (diff)
downloadwabt-39ceee53a9cd23451a28d4e56e151ef76044b5df.tar.gz
wabt-39ceee53a9cd23451a28d4e56e151ef76044b5df.tar.bz2
wabt-39ceee53a9cd23451a28d4e56e151ef76044b5df.zip
Set `end_loc` in folded `if` expressions (#940)
Without this fix, some validation errors will not display the location properly.
Diffstat (limited to 'test/regress')
-rw-r--r--test/regress/regress-23.txt71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/regress/regress-23.txt b/test/regress/regress-23.txt
new file mode 100644
index 00000000..ab32464c
--- /dev/null
+++ b/test/regress/regress-23.txt
@@ -0,0 +1,71 @@
+;;; TOOL: wat2wasm
+;;; ERROR: 1
+
+;; This regression test makes sure that the end_loc of `if` blocks is properly
+;; set when using the folded format.
+
+;; if/else shorthand format, error in true branch.
+(func (result i32)
+ (if (result i32)
+ (i32.const 0)
+ (block
+ (unreachable)
+ )
+ (i32.const 0)
+ )
+)
+
+;; if/else with `then`/`else` keywords, error in true branch.
+(func (result i32)
+ (if (result i32)
+ (i32.const 0)
+ (then
+ (block
+ (unreachable)
+ )
+ )
+ (else
+ (i32.const 0)
+ )
+ )
+)
+
+;; if/else shorthand format, error in false branch.
+(func (result i32)
+ (if (result i32)
+ (i32.const 0)
+ (i32.const 0)
+ (block
+ (unreachable)
+ )
+ )
+)
+
+;; if/else with `then`/`else` keywords, error in false branch.
+(func (result i32)
+ (if (result i32)
+ (i32.const 0)
+ (then
+ (i32.const 0)
+ )
+ (else
+ (block
+ (unreachable)
+ )
+ )
+ )
+)
+(;; STDERR ;;;
+out/test/regress/regress-23.txt:13:5: error: type mismatch in if true branch, expected [i32] but got []
+ )
+ ^
+out/test/regress/regress-23.txt:25:7: error: type mismatch in if true branch, expected [i32] but got []
+ )
+ ^
+out/test/regress/regress-23.txt:41:3: error: type mismatch in if false branch, expected [i32] but got []
+ )
+ ^
+out/test/regress/regress-23.txt:56:3: error: type mismatch in if false branch, expected [i32] but got []
+ )
+ ^
+;;; STDERR ;;)