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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More aggressive type/contract deduplication on hover #1984
More aggressive type/contract deduplication on hover #1984
Changes from 2 commits
ca5de65
a316010
2d84ab1
ff11ba7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure it's ok to sort the annotations. The order of contracts is meaningful in Nickel (different order of application might give a different result). Additionally, if there's no static type, the first contract of the list is taken to be the static type, which also makes a difference statically, and not only at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm deduping them without sorting now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we remove the static type from the annotations.
annotations
is just the list of the type, followed by all contracts, sorted and deduped, right? So, I would expect to find the static type in it, and that it's intentional. Why remove it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I get it. You include the static type in the annotations so that it's deduped (if there is the same as a contract), but you still keep the distinction static type/contracts, so you display the static type separately, and don't want to repeat it in the annotations.
Which I think is the right behavior (the static type is special in that it's the one selected e.g. by the typechecker). Maybe you could add a short mention explaining this (we don't distinguish between types and contracts for the dedup but we will in the LSP answer) to the comment attached to
annotations
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. I've added a comment so hopefully it's less mysterious now