CakeML / pure

A verified compiler for a lazy functional language
Other
32 stars 4 forks source link

Check for distinct declarations in parsing #29

Open hrutvik opened 1 year ago

hrutvik commented 1 year ago

Issue https://github.com/CakeML/pure/issues/27 ensures that most dead code still gets type-checked. However there are still problems with multiple declarations of the same name due to the letrec distinctness pass. Also, the parser must still check for closed expressions, even though type inference already does this.

As discussed in a meeting, this issue suggests:

Unfortunately it is not enough to check top-level declarations only, as demand analysis proofs require letrec_distinct.

Rejection of programs with multiple declarations of the same name is in line with GHC. However, if we support function-clause pattern-matching in the future, we must be careful to align with GHC's behaviour in warning on overlapping patterns rather than rejecting programs when appropriate.