kevinbarabash / compiler

2 stars 0 forks source link

Improve type widening #12

Closed kevinbarabash closed 2 years ago

kevinbarabash commented 2 years ago

This ports a couple of tests from hindley-milner/src/__tests__/infer.tests.ts and fixes an issue with how we were doing substitution. The fix involves now creating new TCon instances in substitute(), instead mutating their .widened property directly. In a future PR we'll try replacing this approach by allow TCon and other types to be substituted instead of just TVars.