alpaca-lang / alpaca

Functional programming inspired by ML for the Erlang VM
Other
1.44k stars 48 forks source link

Exhaustiveness checker crash when importing types from pre-compiled modules #228

Closed j14159 closed 6 years ago

j14159 commented 6 years ago

The exhaustiveness checker will crash when trying to retrieve a type's definition from a module that has been compiled in a previous compiler pass. Roughly: when one module depends on a type from another which has already been compiled, the exhaustiveness checker can't find the module from which to retrieve the type.

E.g.

module A
export_type a
type a = A int

and

module B
import_type A.a
let addXToA x A y = A (x + y)

if A is compiled from a previous run and then we add B (or make changes to it), A won't be in the list of modules for the exhaustiveness checker and a list lookup will fail. I suspect we need to add an annotation to the beam files with erlang terms for all the exported ADTs unless it's already there and I'm overlooking it (@lepoetemaudit pinging you in case I'm just ignorant of something that already exists).