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
Check exhaustivity of pattern matches with "if" guards and custom extractors (by default) and of unsealed types (by opt-in). #9140
Merged
+1,206
−229
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c7ebfdb
SI-5365 Check exhaustivity with guards, extractors
retronym c02a234
Exhaustivity with extractors and unsealed traits.
sellout 2da20d4
Update exhaustivity checking.
sellout e8734c1
Avoid exhaustive warnings in try/catch
dwijnand 03574d8
Check exhaustivity of case class unapplySeq extractors too
dwijnand df6b7f2
Fix the List rewrite in patmat to use 2.13's UnapplySeqWrapper
dwijnand c54081e
Always check exhaustivity of custom extractors/guards
dwijnand 9519ebe
Drop gnomic "It would fail on the following input: _"
dwijnand cb391c2
Make sure counter-examples are distinct
dwijnand 0416c57
Reverse -Xlint:strict-unsealed-patmat into -Xno-unsealed-patmat-analysis
dwijnand 4ef23e4
Avoid spurious custom extractor warnings
dwijnand ac2c3c8
Implement -Xnon-strict-patmat-analysis
dwijnand 3808a6a
Mention reachability warnings on `@unchecked`
dwijnand File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ package scala | |
/** An annotation to designate that the annotated entity | ||
* should not be considered for additional compiler checks. | ||
* Specific applications include annotating the subject of | ||
* a match expression to suppress exhaustiveness warnings, and | ||
* a match expression to suppress exhaustiveness and reachability warnings, and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Old PR, but this doesn't seem to be the case in Scala 2? You also mention it in #9140 (comment). |
||
* annotating a type argument in a match case to suppress | ||
* unchecked warnings. | ||
* | ||
|
Oops, something went wrong.
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.
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.
Doesn't this catch other uses of
SeqFactory.unapplySeq
, likecase Seq()
?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.
Yeah. Which is regrettable, but I couldn't convince myself that that was bad so I went with it... Do you think it'll affect other things and/or have a better idea to fixing the regression?