-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not consider uninhabited constructors when performing exhaustive m…
…atch checking (#21750)
- Loading branch information
Showing
4 changed files
with
38 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
object Foo { | ||
val bar = List() match { | ||
case List() => ??? | ||
case _ => ??? | ||
case null => ??? | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
enum TestAdt: | ||
case Inhabited | ||
case Uninhabited(no: Nothing) | ||
|
||
def test1(t: TestAdt): Int = t match | ||
case TestAdt.Inhabited => 1 | ||
|
||
def test2(o: Option[Option[Nothing]]): Int = o match | ||
case Some(None) => 1 | ||
case None => 2 |