Closed jaccokrijnen closed 3 months ago
The PIR typechecker compiles the datatype, and then only uses the generated types.
I've changed it so that it just uses the annotation (with added type abstractions for the ADT's type parameter). This is consistent with the compiler implementation
Constructors' types are not directly their annotation, but have their result type replaced by the "expected" type (i.e. datatype name applied to all its parameters). Whether all constructors have this expected type is checked separately in
constructor_well_formed
.Why not directly use the annotated type of the constructor? If it doesn't have the expected result type, the typing derivation will go wrong when checking that.