[go: up one dir, main page]

kex oops docs ↗ kex.run ↗

All codes › Parse

KEXEP-0082

error ExpectedFatArrowInMatchClause

[KEXEP-0082]: Error, expected '=>' in match clause, got found

Each arm of a match is pattern => result, with =>. -> is used for function types, not here.

let name(n: Integer) -> String do
  match n do
    1 -> "one"
    _ -> "many"
  end
end
example.kex:3:7: [KEXEP-0082]: Error, expected '=>' in match clause, got ->
  |
3 |     1 -> "one"
  |       ^^

Fixing it

let name(n: Integer) -> String do
  match n do
    1 => "one"
    _ => "many"
  end
end

main do
  IO.printLine(name(1))
end

Edit this explanation

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.