better parser errors
This commit is contained in:
parent
872c8e356d
commit
f83a8e3ca1
13 changed files with 639 additions and 78 deletions
24
error_test/parser/function_errors.sui
Normal file
24
error_test/parser/function_errors.sui
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Function syntax errors
|
||||
|
||||
# Missing function name
|
||||
fn -> int
|
||||
42
|
||||
|
||||
# Missing parameter type annotation
|
||||
fn add(x, y: int) -> int
|
||||
x + y
|
||||
|
||||
# Missing comma in parameters
|
||||
fn add(x: int y: int) -> int
|
||||
x + y
|
||||
|
||||
# Missing closing parenthesis
|
||||
fn add(x: int, y: int -> int
|
||||
x + y
|
||||
|
||||
# Missing return type arrow
|
||||
fn add(x: int, y: int) int
|
||||
x + y
|
||||
|
||||
# Invalid function body (missing expression)
|
||||
fn test() -> int
|
||||
Loading…
Add table
Add a link
Reference in a new issue