suicmez/error_test/parser/pattern_errors.sui
2025-12-15 21:31:29 +05:30

41 lines
No EOL
650 B
Text

# Pattern matching errors
# Invalid pattern in match
fn test() -> int
match 42
x => x
end
# Missing colon in struct pattern
fn test() -> int
struct Point
x: int
y: int
end
let p = Point { x: 5, y: 10 }
match p
Point { x 5, y: 10 } => 1
end
# Invalid enum pattern
fn test() -> int
enum Result
Ok(int)
Err(string)
end
let r = Result::Ok(42)
match r
Result::Ok value => value
end
# Missing pattern in match arm
fn test() -> int
match 42
=> 0
end
# Missing fat arrow in match arm
fn test() -> int
match 42
x 0
end