43 lines
No EOL
713 B
Text
43 lines
No EOL
713 B
Text
# Expression and statement errors
|
|
|
|
# Missing variable name in let
|
|
fn test() -> int
|
|
let = 5
|
|
42
|
|
|
|
# Missing equals in assignment
|
|
fn test() -> int
|
|
let x 5
|
|
x
|
|
|
|
# Missing expression after operator
|
|
fn test() -> int
|
|
5 +
|
|
|
|
# Invalid array syntax (missing comma)
|
|
fn test() -> int
|
|
let arr = [1 2 3]
|
|
arr[0]
|
|
|
|
# Missing closing bracket in array
|
|
fn test() -> int
|
|
let arr = [1, 2, 3
|
|
arr[0]
|
|
|
|
# Invalid struct literal (missing field value)
|
|
fn test() -> int
|
|
struct Point
|
|
x: int
|
|
y: int
|
|
end
|
|
let p = Point { x: 5, y }
|
|
p.x
|
|
|
|
# Missing colon in struct literal
|
|
fn test() -> int
|
|
struct Point
|
|
x: int
|
|
y: int
|
|
end
|
|
let p = Point { x 5, y: 10 }
|
|
p.x |