-
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.
Don't reduce inline matches, when a guard cannot be checked at compile
time fixes #13570
- Loading branch information
1 parent
aaac006
commit d60ce59
Showing
3 changed files
with
37 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Error: tests/neg/i13570.scala:8:5 ----------------------------------------------------------------------------------- | ||
8 | jim(Seq(1,2)) // error | ||
| ^^^^^^^^^^^^^ | ||
| cannot reduce inline match with | ||
| scrutinee: seq$proxy1 : (seq$proxy1 : Seq[Int]) | ||
| patterns : case s @ _:Seq[Int] if s.isEmpty | ||
| case s @ _:Seq[Int] | ||
| case _ | ||
| This location contains code that was inlined from i13570.scala:3 |
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 @@ | ||
object Test: | ||
inline def jim(seq: Seq[Int]) = | ||
inline seq match | ||
case s: Seq[Int] if s.isEmpty => println("seq is empty") | ||
case s: Seq[Int] => println("seq is not empty") | ||
case _ => println("somthing hinky happened") | ||
|
||
jim(Seq(1,2)) // error |