Conversation
For type annotations like `a -> b -> c ->{IO} d`, making up variables
for the two un-annotated arrows can be a detriment to type inference.
So, instead, if we know that the corresponding function is `x y z -> ...`
in the relevant spot, we simply annotate with empty ability lists.
Contributor
Author
|
Should fix #6207, at least the specific case. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains some type checking tweaks to handle some cases that were previously errors. The simplest example is
The issue with this is that the inferred type of
fwill not be general enough to satisfy the supplied signature forgwhen they are checked as a single group. The new approach partitions definitions into those that require inference vs. those that require checking, and generalizes the former before checking the latter.However, just that change wouldn't allow e.g.
because
gwas still not completely closed. It actually got expanded toforall a b. a ->{g} b ->{IO} a, wheregrequires inference, and can't be split out. To fix this, I made the function that inserts these ability inference variables aware of how many lambda-bound variables there are, because only the last variable can have a non-empty ability list. This means that the signature above gets immediately completed toforall a b. a ->{} b ->{IO} a, which is closed, and can be split out.I tried detecting the error situation (which could still happen in general) in the error recognizer, to give a more specific error message. However, it actually doesn't seem easy to do so. I think the actual error that happens is an attempt to solve an out-of-order variable in the context, but trying to test for that didn't seem to work. So, this PR merely increases the number of programs we can check, and doesn't give a better indication of what's going on in the odd cases. Perhaps I can revisit the error message in the future.