All codes › Parse
KEXEP-0078
error ExpectedDoAfterMatchSubject
[KEXEP-0078]: Error, expected 'do' after match subject, got found
The subject of a match is followed by do, as in match n do. Here the line ends after n.
let name(n: Integer) -> String do
match n
1 => "one"
_ => "many"
end
end
example.kex:2:10: [KEXEP-0078]: Error, expected 'do' after match subject, got Newline
|
2 | match n
| ^
Ruby's case n ... when 1 is written match n do ... 1 => in Kex.
Fixing it
let name(n: Integer) -> String do
match n do
1 => "one"
_ => "many"
end
end
main do
IO.printLine(name(1))
end
Is this diagnostic reported where it should not be, missing where it should be, or saying the wrong thing? Report it on the compiler's issue tracker.