cogent icon indicating copy to clipboard operation
cogent copied to clipboard

impossible happened when desugaring

Open gteege opened this issue 6 years ago • 1 comments

The compiler asked me to report this...

When compiling the following cogent source with cogent -g pattern.txt

the compiler output was log.txt

gteege avatar Nov 19 '18 16:11 gteege

@zilinc I've replicated the failure and worked out what's causing it. Here's an even simpler program which reproduces the error.

m: () -> ()
m b =
  b | () -> ()
    | _ -> ()

Essentially, the compiler assumes that if there are multiple alternatives, none of them are irrefutable (Desugar.hs:307). I'm not sure this is a good assumption, given cases like the above; maybe we should replace it with a warning/error?

vjackson725 avatar Nov 19 '18 22:11 vjackson725