-
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.
Backport "Fix #20372: Check pattern match exhaustivity in inlined cod…
…e" to LTS (#21115) Backports #20403 to the LTS branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
4 changed files
with
26 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- [E029] Pattern Match Exhaustivity Warning: tests/warn/i20372.scala:8:5 ---------------------------------------------- | ||
8 | id(foo match { // warn | ||
| ^^^ | ||
| match may not be exhaustive. | ||
| | ||
| It would fail on pattern case: Baz | ||
| | ||
| longer explanation available when compiling with `-explain` |
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 @@ | ||
sealed trait Foo | ||
case object Bar extends Foo | ||
case object Baz extends Foo | ||
|
||
inline def id[A](a: A): A = a | ||
|
||
def shouldThrowAWarning(foo: Foo) = | ||
id(foo match { // warn | ||
case Bar => "Bar" | ||
}) |