-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some bugs in record type inference.
In the previous implementation, it was possible for inference to emit RecordSplit on values that weren't yet known to be records (well, inference knew it, but hadn't constrained it to be so). This was causing type errors for RecordSplit when `getType` was called before inference solved for the missing type variables. The fix is to constrain the type to be a record (with unknown fields) and then zonk the expression before emitting a RecordSplit. This has the (surprising!) side effect of actually greatly simplifying the pattern match logic; it turns out that most of that was just duplicating work that unification had to do anyway. This fix exposed a second problem with row inference, which was that I forgot to include the base case for unifying two things that can't possibly be equal! Now, if we try to unify anything other than a type variable with an empty row, we throw a type error immediately.
- Loading branch information
1 parent
24a3c8a
commit 099cd16
Showing
4 changed files
with
53 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters