ipso icon indicating copy to clipboard operation
ipso copied to clipboard

Poor error for incomplete pattern match

Open LightAndLight opened this issue 3 years ago • 0 comments

This program:

f : (| A : a, r |) -> a
f x =
  case x of
    A a -> a

main : IO ()
main = io.pure ()

gives this error:

test.ipso:3:8: error: expected type "()", got type "r"
  |
3 |   case x of
  |        ^

There are a few problems with this:

  1. ~~The error is reported in the incorrect position. The caret should point to x in case x of.~~ Fixed in #184
  2. The empty row is rendered as (), which looks like the unit type. Super confusing!
  3. The error only describes the problem indirectly. It would be better to say expected type "(| A : a |)", got type "(| A : a, r |)". Or better yet, say that the pattern match is incomplete.

LightAndLight avatar May 14 '22 09:05 LightAndLight