-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9740 from smarter/backport-case-without-future
[backport] Allow `case` in pattern bindings even without -Xsource:3
- Loading branch information
Showing
7 changed files
with
30 additions
and
55 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,13 +1,7 @@ | ||
for-comprehension-case.scala:5: error: `case` keyword in for comprehension requires the -Xsource:3 flag. | ||
case Some(x) <- List(Some(1), None) | ||
^ | ||
for-comprehension-case.scala:12: error: `case` keyword in for comprehension requires the -Xsource:3 flag. | ||
case y = x + 1 | ||
^ | ||
for-comprehension-case.scala:12: error: '<-' expected but '=' found. | ||
for-comprehension-case.scala:20: error: '<-' expected but '=' found. | ||
case y = x + 1 | ||
^ | ||
for-comprehension-case.scala:13: error: illegal start of simple expression | ||
} yield x+y | ||
for-comprehension-case.scala:21: error: illegal start of simple expression | ||
} yield x + y | ||
^ | ||
four errors found | ||
two errors found |
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,14 +1,22 @@ | ||
class A { | ||
// fail | ||
// ok | ||
val a = | ||
for { | ||
case Some(x) <- List(Some(1), None) | ||
} yield x | ||
y = x + 1 | ||
} yield x + y | ||
|
||
// fail | ||
// ok | ||
val b = | ||
for { | ||
Some(x) <- List(Some(1), None) | ||
case y = x + 1 | ||
Some(y) <- List(None, Some(2)) | ||
} yield x+y | ||
|
||
// fail | ||
val c = | ||
for { | ||
case Some(x) <- List(Some(1), None) | ||
case y = x + 1 | ||
} yield x + y | ||
} |