Skip to content

Commit

Permalink
Add test for simple type check in global initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Nak committed Nov 26, 2024
1 parent 43461dd commit 7f349e4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
25 changes: 25 additions & 0 deletions crates/parser/test_files/errors/global_declaration.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
source: crates/parser/tests/errors.rs
input_file: test_files/errors/global_declaration.sntn
---
error: parse error
--> global_declaration.sntn:5:28
|
5 | global private i256 $IMM = [0]
| ^^^ type error: expected `i256` here
|error: parse error
--> global_declaration.sntn:6:38
|
6 | global public const [i8; 1] $ARRAY = [1, 2]
| ^^^^^^ type error: expected `i8` here
|error: parse error
--> global_declaration.sntn:7:33
|
7 | global public const @foo $FOO = { 1, 2 }
| ^^^^^^^^ type error: expected `@foo` here
|error: parse error
--> global_declaration.sntn:8:38
|
8 | global public const @bar $BAR = { 1, {1, 2} }
| ^^^^^^ type error: expected `@foo` here
|
9 changes: 9 additions & 0 deletions crates/parser/test_files/errors/global_declaration.sntn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
target = "evm-ethereum-cancun"

type @foo = { i8, i16, *i64 };
type @bar = { i16, @foo };

global private i256 $IMM = [0]
global public const [i8; 1] $ARRAY = [1, 2]
global public const @foo $FOO = { 1, 2 }
global public const @bar $BAR = { 1, {1, 2} }

0 comments on commit 7f349e4

Please sign in to comment.