-
Notifications
You must be signed in to change notification settings - Fork 260
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
chore: improve error message for seq type mismatch #2790
Conversation
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.
Looks good, but: are you actually using the new overload?
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.
One more small thing that I just caught; sorry! IIUC the problem isn't ToString, it's .AsSeqType.Arg
, right?
Co-authored-by: Clément Pit-Claudel <[email protected]>
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.
🎉
Fixes #1887.
This adds a wrapper to "lazily" retrieve the string representation of a sequence's element type that is unresolved while the type constraint (and its error message) is being constructed.
For simplicity, instead of the originally proposed message
this PR changes the sequence-type-mismatch error message to
when a type mismatch arises from a single selection (e.g.
s[0]
).When a type mismatch arises from a "multi-selection" (e.g.
s[0..2]
), the expected type is anInferredTypeProxy
that may not resolve to a sequence type at all, in which case we can't speak of the expected sequence type's type argument. For that reason the multi-selection type mismatch error message makes no mention of the expected type argument:By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.