-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for simple type check in global initializer
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} } |