better parser errors
This commit is contained in:
parent
872c8e356d
commit
f83a8e3ca1
13 changed files with 639 additions and 78 deletions
49
error_test/parser/control_flow_errors.sui
Normal file
49
error_test/parser/control_flow_errors.sui
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Control flow errors
|
||||
|
||||
# Missing condition in if
|
||||
fn test() -> int
|
||||
if
|
||||
42
|
||||
else
|
||||
0
|
||||
|
||||
# Missing body in if
|
||||
fn test() -> int
|
||||
if true
|
||||
else
|
||||
0
|
||||
|
||||
# Missing variable in for loop
|
||||
fn test() -> int
|
||||
for in [1, 2, 3]
|
||||
item
|
||||
0
|
||||
|
||||
# Missing 'in' keyword in for loop
|
||||
fn test() -> int
|
||||
for item [1, 2, 3]
|
||||
item
|
||||
0
|
||||
|
||||
# Missing iterable in for loop
|
||||
fn test() -> int
|
||||
for item in
|
||||
item
|
||||
0
|
||||
|
||||
# Invalid while syntax
|
||||
fn test() -> int
|
||||
while
|
||||
42
|
||||
|
||||
# Missing parameters in lambda
|
||||
fn test() -> int
|
||||
let f = lambda
|
||||
42
|
||||
f()
|
||||
|
||||
# Missing closing parenthesis in lambda
|
||||
fn test() -> int
|
||||
let f = lambda(x
|
||||
x
|
||||
f(5)
|
||||
Loading…
Add table
Add a link
Reference in a new issue