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.
We've previously handled completion for let bindings where there's also a type annotation:
This gives completion because we look up that we're in a record called
user
.However, this same snippet below should be valid if we've saved and compiled, even if there's no explicit type annotation:
let user
will have the inferred type ofuser
. But, this hasn't been picked up before.This PR fixes that, by trying to complete for "the type at the position of the let binding" if there's no explicit type annotation. The cool part is that the compiler is quite liberal with assigning a type to the let binding even if it's not fully compiling. So, you could write a record expression without a type annotation, save and let the compiler infer what record it thinks you're trying to construct, and then get completions for that, even if the thing you're trying to construct isn't complete/doesn't type check yet.
Will make for a nicer DX when using inference.