diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.4k stars 167 forks source link

Internal compiler error #1232

Closed nqpz closed 3 years ago

nqpz commented 3 years ago

The program

type option 'a = #some a | #none

let bind 'a 'b (m: option a) (f: a -> option b): option b =
  match m
  case #none -> #none
  case #some a -> f a

entry foo (n: i32): bool =
  match bind (if n == 0 then #some () else #none)
             (\() -> #some true)
  case #some res -> res
  case #none -> true

produces the error

processFlatPattern: insufficient identifiers in pattern.([Ident {identName = VName (Name "nameless") 3915, identType = Info {unInfo = Scalar (Prim Bool)}, identSrcLoc = noLoc}],[])
CallStack (from HasCallStack):
  error, called at src/Futhark/Internalise/Bindings.hs:96:7 in futhark-0.19.0-2V6GCosZ0r28tYyck4f4gH:Futhark.Internalise.Bindings

when run with futhark c from git.

athas commented 3 years ago

Simpler case:

let main (x: i32) =
  match ()
  case () -> x

I wonder how we never noticed this before.