apoch / epoch-language

Home of the Epoch Programming Language Project
Other
72 stars 3 forks source link

Automatically generated type dispatchers are missing some type possibilities #191

Closed apoch closed 7 years ago

apoch commented 7 years ago

Consider a program with:

In the current compiler implementation, the type dispatcher will be generated and only one overload is detected (correct) so the parameter is assumed to always be of type SomeStructure (incorrect).

A sledgehammer approach is to have the type checker analyze all call sites to a type dispatcher and note which types are passed in. These type hints would be used for autogeneration of the dispatcher instead of overload analysis. Main risk here is allowing dispatch on types that are illegal and can be statically verified as not possible to work at runtime.

apoch commented 7 years ago

This is fixed, strictly speaking. Type dispatcher codegen is still shaky but this particular problem has been addressed - using the sledgehammer approach described in the bug.