forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exhaustivity warnings on nested case classes
Fixes scala#13003, by refixing scala#12485 (PR scala#12488). Part of the issue is that isCheckable behaves differently under -Ycheck-all-patmat and our tests only run under that flag. So for starters I added a test variant where that flag isn't used. I'd like to understand why that flag exists to see if we could remove it from guarding the logic and the tests. Also make sure that any patmat test that throws an exception fails the test...
- Loading branch information
Showing
5 changed files
with
34 additions
and
10 deletions.
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
4: Pattern Match Exhaustivity: One(Two(None)) | ||
7: Pattern Match Exhaustivity: Two(None) | ||
10: Pattern Match Exhaustivity: None, Some(None) | ||
13: Pattern Match Exhaustivity: None, Some(None), Some(Some(None)) |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
case class One(two: Two) | ||
case class Two(o: Option[Int]) | ||
|
||
def matchOneTwo(one: One) = one match | ||
case One(Two(Some(i))) => "match!" | ||
|
||
def matchTwo(two: Two) = two match | ||
case Two(Some(i)) => "match!" | ||
|
||
def matchOO(oo: Option[Option[Int]]) = oo match | ||
case Some(Some(i)) => "match!" | ||
|
||
def matchOOO(ooo: Option[Option[Option[Int]]]) = ooo match | ||
case Some(Some(Some(i))) => "match!" |