-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve diagnostic for refutable extractors in pattern bindings #14988
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.
This is a great improvement, I would like it more if the error message could remind the user that means either potential match failure for val
definitions, or filtered entries in the for
comprehension
6e62644
to
cb0457a
Compare
else "will result in a filtering for expression (using `withFilter`)" | ||
val usage = reason match | ||
case NonConforming => "the narrowing" | ||
case RefutableExtractor => "this usage" |
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.
Suddenly, I want to write two novels about the sinister underworld, one called "The Narrowing" and the other called "This Usage".
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.
very nice
Avoids nonsensical messages such as: pattern's type Int is more specialized than the right hand side expression's type Int when the underlying cause is that the extractor is refutable.
cb0457a
to
3ddbf8e
Compare
Avoids nonsensical messages such as:
when the underlying cause is that the extractor is refutable.
Extracted from #14294