suicmez/error_test/parser/control_flow_errors.sui

49 lines
687 B
Text
Raw Normal View History

2025-12-15 21:18:25 +05:30
# 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)