summaryrefslogtreecommitdiff
path: root/test/typecheck
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2021-12-10 08:47:14 -0800
committerGitHub <noreply@github.com>2021-12-10 16:47:14 +0000
commit1d645885f93a7f2240176b0fd994f2408b963a7b (patch)
tree1d5850960d5c02067f3b72fd75c2706f3be13a40 /test/typecheck
parent9aba936bfab0fe9e639da6ea3b5fe3d8a3a0f1c0 (diff)
downloadwabt-1d645885f93a7f2240176b0fd994f2408b963a7b.tar.gz
wabt-1d645885f93a7f2240176b0fd994f2408b963a7b.tar.bz2
wabt-1d645885f93a7f2240176b0fd994f2408b963a7b.zip
Share validation code between constant expressions and function bodies. NFC (#1783)
Previously we has special cases for initializer expressions (constant expressions). This change paves the way for adding support for extended constant expressions that support a wider range of instructions. This change removes twice as many lines as it adds which shows that this simplification is probably worthwhile even without the pending extensions.
Diffstat (limited to 'test/typecheck')
-rw-r--r--test/typecheck/bad-global-getglobal-type-mismatch.txt2
-rw-r--r--test/typecheck/bad-global-no-init-expr.txt4
-rw-r--r--test/typecheck/bad-global-type-mismatch.txt2
3 files changed, 4 insertions, 4 deletions
diff --git a/test/typecheck/bad-global-getglobal-type-mismatch.txt b/test/typecheck/bad-global-getglobal-type-mismatch.txt
index 545712a6..7510efae 100644
--- a/test/typecheck/bad-global-getglobal-type-mismatch.txt
+++ b/test/typecheck/bad-global-getglobal-type-mismatch.txt
@@ -4,7 +4,7 @@
(import "foo" "bar" (global i32))
(global f32 (get_global 0)))
(;; STDERR ;;;
-out/test/typecheck/bad-global-getglobal-type-mismatch.txt:5:16: error: type mismatch at global initializer expression. got i32, expected f32
+out/test/typecheck/bad-global-getglobal-type-mismatch.txt:5:16: error: type mismatch in constant expression, expected [f32] but got [i32]
(global f32 (get_global 0)))
^^^^^^^^^^
;;; STDERR ;;)
diff --git a/test/typecheck/bad-global-no-init-expr.txt b/test/typecheck/bad-global-no-init-expr.txt
index 2acab9f7..d81ba8e3 100644
--- a/test/typecheck/bad-global-no-init-expr.txt
+++ b/test/typecheck/bad-global-no-init-expr.txt
@@ -4,10 +4,10 @@
(global i32)
(global (mut f32)))
(;; STDERR ;;;
-out/test/typecheck/bad-global-no-init-expr.txt:4:4: error: invalid global initializer expression, must be a constant expression
+out/test/typecheck/bad-global-no-init-expr.txt:4:4: error: type mismatch in constant expression, expected [i32] but got []
(global i32)
^^^^^^
-out/test/typecheck/bad-global-no-init-expr.txt:5:4: error: invalid global initializer expression, must be a constant expression
+out/test/typecheck/bad-global-no-init-expr.txt:5:4: error: type mismatch in constant expression, expected [f32] but got []
(global (mut f32)))
^^^^^^
;;; STDERR ;;)
diff --git a/test/typecheck/bad-global-type-mismatch.txt b/test/typecheck/bad-global-type-mismatch.txt
index e496c338..ba94d2eb 100644
--- a/test/typecheck/bad-global-type-mismatch.txt
+++ b/test/typecheck/bad-global-type-mismatch.txt
@@ -3,7 +3,7 @@
(module
(global i32 (f32.const 1)))
(;; STDERR ;;;
-out/test/typecheck/bad-global-type-mismatch.txt:4:16: error: type mismatch at global initializer expression. got f32, expected i32
+out/test/typecheck/bad-global-type-mismatch.txt:4:16: error: type mismatch in constant expression, expected [i32] but got [f32]
(global i32 (f32.const 1)))
^^^^^^^^^
;;; STDERR ;;)