Skip to content

[WebAssembly] Add intentations to type-checker-error.s #111071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Oct 3, 2024

No description provided.

@aheejin aheejin requested a review from dschuff October 3, 2024 22:42
@llvmbot llvmbot added backend:WebAssembly mc Machine (object) code labels Oct 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 3, 2024

@llvm/pr-subscribers-backend-webassembly

Author: Heejin Ahn (aheejin)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/111071.diff

1 Files Affected:

  • (modified) llvm/test/MC/WebAssembly/type-checker-errors.s (+42-42)
diff --git a/llvm/test/MC/WebAssembly/type-checker-errors.s b/llvm/test/MC/WebAssembly/type-checker-errors.s
index df537a9ba5d0a0..c5187d10fdca07 100644
--- a/llvm/test/MC/WebAssembly/type-checker-errors.s
+++ b/llvm/test/MC/WebAssembly/type-checker-errors.s
@@ -297,7 +297,7 @@ end_block_insufficient_values_on_stack_2:
 end_block_type_mismatch:
   .functype end_block_type_mismatch () -> ()
   block i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   end_block
   drop
@@ -314,7 +314,7 @@ end_loop_insufficient_values_on_stack:
 end_loop_type_mismatch:
   .functype end_loop_type_mismatch () -> ()
   loop f32
-  i32.const 1
+    i32.const 1
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [f32] but got [i32]
   end_loop
   drop
@@ -332,7 +332,7 @@ end_if_type_mismatch_1:
   .functype end_if_type_mismatch_1 () -> ()
   i32.const 1
   if f32
-  i32.const 1
+    i32.const 1
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [f32] but got [i32]
   end_if
   drop
@@ -342,7 +342,7 @@ end_if_insufficient_values_on_stack_2:
   .functype end_if_insufficient_values_on_stack_2 () -> ()
   i32.const 1
   if i32
-  i32.const 2
+    i32.const 2
   else
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   end_if
@@ -353,9 +353,9 @@ end_if_type_mismatch_2:
   .functype end_if_type_mismatch_2 () -> ()
   i32.const 1
   if i32
-  i32.const 2
+    i32.const 2
   else
-  f32.const 3.0
+    f32.const 3.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   end_if
   drop
@@ -367,7 +367,7 @@ else_insufficient_values_on_stack:
   if i32
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   else
-  i32.const 0
+    i32.const 0
   end_if
   drop
   end_function
@@ -376,10 +376,10 @@ else_type_mismatch:
   .functype else_type_mismatch () -> ()
   i32.const 1
   if i32
-  f32.const 0.0
+    f32.const 0.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   else
-  i32.const 0
+    i32.const 0
   end_if
   drop
   end_function
@@ -390,7 +390,7 @@ else_type_mismatch:
 end_try_insufficient_values_on_stack:
   .functype end_try_insufficient_values_on_stack () -> ()
   try i32
-  i32.const 0
+    i32.const 0
   catch_all
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   end_try
@@ -400,7 +400,7 @@ end_try_insufficient_values_on_stack:
 end_try_type_mismatch:
   .functype end_try_type_mismatch () -> ()
   try i32
-  i32.const 0
+    i32.const 0
   catch tag_f32
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   end_try
@@ -419,7 +419,7 @@ catch_insufficient_values_on_stack:
 catch_type_mismatch:
   .functype catch_type_mismatch () -> ()
   try i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   catch tag_i32
   end_try
@@ -431,7 +431,7 @@ catch_all_insufficient_values_on_stack:
   try i32
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   catch_all
-  i32.const 0
+    i32.const 0
   end_try
   drop
   end_function
@@ -439,10 +439,10 @@ catch_all_insufficient_values_on_stack:
 catch_all_type_mismatch:
   .functype catch_all_type_mismatch () -> ()
   try i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   catch_all
-  i32.const 0
+    i32.const 0
   end_try
   drop
   end_function
@@ -458,7 +458,7 @@ delegate_insufficient_values_on_stack:
 delegate_type_mismatch:
   .functype delegate_type_mismatch () -> ()
   try i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   delegate 0
   drop
@@ -679,7 +679,7 @@ other_insn_test_3:
 check_after_unreachable_within_block:
   .functype check_after_unreachable_within_block () -> ()
   block
-  unreachable
+    unreachable
   end_block
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -689,7 +689,7 @@ check_after_unreachable_within_block:
 check_after_unreachable_within_loop:
   .functype check_after_unreachable_within_loop () -> ()
   loop
-  unreachable
+    unreachable
   end_loop
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -700,9 +700,9 @@ check_after_unreachable_within_if_1:
   .functype check_after_unreachable_within_if_1 () -> ()
   i32.const 0
   if
-  unreachable
+    unreachable
   else
-  unreachable
+    unreachable
   end_if
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -713,10 +713,10 @@ check_after_unreachable_within_if_2:
   .functype check_after_unreachable_within_if_2 () -> ()
   i32.const 0
   if
-  unreachable
+    unreachable
   else
-# CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
-  drop
+# CHECK: :[[@LINE+1]]:5: error: type mismatch, expected [any] but got []
+    drop
   end_if
   end_function
 
@@ -724,9 +724,9 @@ check_after_unreachable_within_if_2:
 check_after_unreachable_within_try_1:
   .functype check_after_unreachable_within_try_1 () -> ()
   try
-  unreachable
+    unreachable
   catch_all
-  unreachable
+    unreachable
   end_try
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -736,11 +736,11 @@ check_after_unreachable_within_try_1:
 check_after_unreachable_within_try_2:
   .functype check_after_unreachable_within_try_2 () -> ()
   try
-  unreachable
+    unreachable
   catch tag_i32
-  drop
-# CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
-  drop
+    drop
+# CHECK: :[[@LINE+1]]:5: error: type mismatch, expected [any] but got []
+    drop
   end_try
   end_function
 
@@ -748,10 +748,10 @@ check_after_unreachable_within_try_2:
 check_after_unreachable_within_try_3:
   .functype check_after_unreachable_within_try_3 () -> ()
   try
-  unreachable
+    unreachable
   catch_all
-# CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
-  drop
+# CHECK: :[[@LINE+1]]:5: error: type mismatch, expected [any] but got []
+    drop
   end_try
   end_function
 
@@ -759,7 +759,7 @@ check_after_unreachable_within_try_3:
 check_after_unreachable_within_try_4:
   .functype check_after_unreachable_within_try_4 () -> ()
   try
-  unreachable
+    unreachable
   delegate 0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -838,12 +838,12 @@ br_invalid_type_catch_all:
 br_invalid_depth_out_of_range:
   .functype br_invalid_depth_out_of_range () -> ()
   block
-  block
-  block
-# CHECK: :[[@LINE+1]]:5: error: br: invalid depth 4
-    br 4
-  end_block
-  end_block
+    block
+      block
+# CHECK: :[[@LINE+1]]:9: error: br: invalid depth 4
+        br 4
+      end_block
+    end_block
   end_block
   end_function
 
@@ -936,9 +936,9 @@ block_param_and_return:
   drop
 
   block f32
-  f32.const 0.0
-  br 0
-  i32.const 0
+    f32.const 0.0
+    br 0
+    i32.const 0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [f32] but got [..., i32]
   end_block
 

@llvmbot
Copy link
Member

llvmbot commented Oct 3, 2024

@llvm/pr-subscribers-mc

Author: Heejin Ahn (aheejin)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/111071.diff

1 Files Affected:

  • (modified) llvm/test/MC/WebAssembly/type-checker-errors.s (+42-42)
diff --git a/llvm/test/MC/WebAssembly/type-checker-errors.s b/llvm/test/MC/WebAssembly/type-checker-errors.s
index df537a9ba5d0a0..c5187d10fdca07 100644
--- a/llvm/test/MC/WebAssembly/type-checker-errors.s
+++ b/llvm/test/MC/WebAssembly/type-checker-errors.s
@@ -297,7 +297,7 @@ end_block_insufficient_values_on_stack_2:
 end_block_type_mismatch:
   .functype end_block_type_mismatch () -> ()
   block i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   end_block
   drop
@@ -314,7 +314,7 @@ end_loop_insufficient_values_on_stack:
 end_loop_type_mismatch:
   .functype end_loop_type_mismatch () -> ()
   loop f32
-  i32.const 1
+    i32.const 1
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [f32] but got [i32]
   end_loop
   drop
@@ -332,7 +332,7 @@ end_if_type_mismatch_1:
   .functype end_if_type_mismatch_1 () -> ()
   i32.const 1
   if f32
-  i32.const 1
+    i32.const 1
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [f32] but got [i32]
   end_if
   drop
@@ -342,7 +342,7 @@ end_if_insufficient_values_on_stack_2:
   .functype end_if_insufficient_values_on_stack_2 () -> ()
   i32.const 1
   if i32
-  i32.const 2
+    i32.const 2
   else
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   end_if
@@ -353,9 +353,9 @@ end_if_type_mismatch_2:
   .functype end_if_type_mismatch_2 () -> ()
   i32.const 1
   if i32
-  i32.const 2
+    i32.const 2
   else
-  f32.const 3.0
+    f32.const 3.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   end_if
   drop
@@ -367,7 +367,7 @@ else_insufficient_values_on_stack:
   if i32
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   else
-  i32.const 0
+    i32.const 0
   end_if
   drop
   end_function
@@ -376,10 +376,10 @@ else_type_mismatch:
   .functype else_type_mismatch () -> ()
   i32.const 1
   if i32
-  f32.const 0.0
+    f32.const 0.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   else
-  i32.const 0
+    i32.const 0
   end_if
   drop
   end_function
@@ -390,7 +390,7 @@ else_type_mismatch:
 end_try_insufficient_values_on_stack:
   .functype end_try_insufficient_values_on_stack () -> ()
   try i32
-  i32.const 0
+    i32.const 0
   catch_all
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   end_try
@@ -400,7 +400,7 @@ end_try_insufficient_values_on_stack:
 end_try_type_mismatch:
   .functype end_try_type_mismatch () -> ()
   try i32
-  i32.const 0
+    i32.const 0
   catch tag_f32
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   end_try
@@ -419,7 +419,7 @@ catch_insufficient_values_on_stack:
 catch_type_mismatch:
   .functype catch_type_mismatch () -> ()
   try i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   catch tag_i32
   end_try
@@ -431,7 +431,7 @@ catch_all_insufficient_values_on_stack:
   try i32
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got []
   catch_all
-  i32.const 0
+    i32.const 0
   end_try
   drop
   end_function
@@ -439,10 +439,10 @@ catch_all_insufficient_values_on_stack:
 catch_all_type_mismatch:
   .functype catch_all_type_mismatch () -> ()
   try i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   catch_all
-  i32.const 0
+    i32.const 0
   end_try
   drop
   end_function
@@ -458,7 +458,7 @@ delegate_insufficient_values_on_stack:
 delegate_type_mismatch:
   .functype delegate_type_mismatch () -> ()
   try i32
-  f32.const 1.0
+    f32.const 1.0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [i32] but got [f32]
   delegate 0
   drop
@@ -679,7 +679,7 @@ other_insn_test_3:
 check_after_unreachable_within_block:
   .functype check_after_unreachable_within_block () -> ()
   block
-  unreachable
+    unreachable
   end_block
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -689,7 +689,7 @@ check_after_unreachable_within_block:
 check_after_unreachable_within_loop:
   .functype check_after_unreachable_within_loop () -> ()
   loop
-  unreachable
+    unreachable
   end_loop
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -700,9 +700,9 @@ check_after_unreachable_within_if_1:
   .functype check_after_unreachable_within_if_1 () -> ()
   i32.const 0
   if
-  unreachable
+    unreachable
   else
-  unreachable
+    unreachable
   end_if
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -713,10 +713,10 @@ check_after_unreachable_within_if_2:
   .functype check_after_unreachable_within_if_2 () -> ()
   i32.const 0
   if
-  unreachable
+    unreachable
   else
-# CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
-  drop
+# CHECK: :[[@LINE+1]]:5: error: type mismatch, expected [any] but got []
+    drop
   end_if
   end_function
 
@@ -724,9 +724,9 @@ check_after_unreachable_within_if_2:
 check_after_unreachable_within_try_1:
   .functype check_after_unreachable_within_try_1 () -> ()
   try
-  unreachable
+    unreachable
   catch_all
-  unreachable
+    unreachable
   end_try
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -736,11 +736,11 @@ check_after_unreachable_within_try_1:
 check_after_unreachable_within_try_2:
   .functype check_after_unreachable_within_try_2 () -> ()
   try
-  unreachable
+    unreachable
   catch tag_i32
-  drop
-# CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
-  drop
+    drop
+# CHECK: :[[@LINE+1]]:5: error: type mismatch, expected [any] but got []
+    drop
   end_try
   end_function
 
@@ -748,10 +748,10 @@ check_after_unreachable_within_try_2:
 check_after_unreachable_within_try_3:
   .functype check_after_unreachable_within_try_3 () -> ()
   try
-  unreachable
+    unreachable
   catch_all
-# CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
-  drop
+# CHECK: :[[@LINE+1]]:5: error: type mismatch, expected [any] but got []
+    drop
   end_try
   end_function
 
@@ -759,7 +759,7 @@ check_after_unreachable_within_try_3:
 check_after_unreachable_within_try_4:
   .functype check_after_unreachable_within_try_4 () -> ()
   try
-  unreachable
+    unreachable
   delegate 0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [any] but got []
   drop
@@ -838,12 +838,12 @@ br_invalid_type_catch_all:
 br_invalid_depth_out_of_range:
   .functype br_invalid_depth_out_of_range () -> ()
   block
-  block
-  block
-# CHECK: :[[@LINE+1]]:5: error: br: invalid depth 4
-    br 4
-  end_block
-  end_block
+    block
+      block
+# CHECK: :[[@LINE+1]]:9: error: br: invalid depth 4
+        br 4
+      end_block
+    end_block
   end_block
   end_function
 
@@ -936,9 +936,9 @@ block_param_and_return:
   drop
 
   block f32
-  f32.const 0.0
-  br 0
-  i32.const 0
+    f32.const 0.0
+    br 0
+    i32.const 0
 # CHECK: :[[@LINE+1]]:3: error: type mismatch, expected [f32] but got [..., i32]
   end_block
 

@aheejin aheejin merged commit 83e3779 into llvm:main Oct 4, 2024
11 checks passed
@aheejin aheejin deleted the type_check_error_indent branch October 4, 2024 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:WebAssembly mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants