-
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 #6348 from eed3si9n/wip/deprecate-val-in-for
Remove val in for comprehension under -Xsource:2.14
- Loading branch information
Showing
5 changed files
with
53 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
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,25 @@ | ||
for-comprehension-val.scala:3: error: `val` keyword in for comprehension is unsupported: instead, bind the value without `val` | ||
for (x <- 1 to 5 ; val y = x) yield x+y // fail | ||
^ | ||
for-comprehension-val.scala:4: error: `val` keyword in for comprehension is unsupported: just remove `val` | ||
for (val x <- 1 to 5 ; y = x) yield x+y // fail | ||
^ | ||
for-comprehension-val.scala:5: error: `val` keyword in for comprehension is unsupported: just remove `val` | ||
for (val x <- 1 to 5 ; val y = x) yield x+y // fail | ||
^ | ||
for-comprehension-val.scala:5: error: `val` keyword in for comprehension is unsupported: instead, bind the value without `val` | ||
for (val x <- 1 to 5 ; val y = x) yield x+y // fail | ||
^ | ||
for-comprehension-val.scala:8: error: `val` keyword in for comprehension is unsupported: instead, bind the value without `val` | ||
for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // fail | ||
^ | ||
for-comprehension-val.scala:9: error: `val` keyword in for comprehension is unsupported: just remove `val` | ||
for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail | ||
^ | ||
for-comprehension-val.scala:10: error: `val` keyword in for comprehension is unsupported: just remove `val` | ||
for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail | ||
^ | ||
for-comprehension-val.scala:10: error: `val` keyword in for comprehension is unsupported: instead, bind the value without `val` | ||
for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail | ||
^ | ||
8 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
-deprecation -Xsource:2.14 |
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,11 @@ | ||
class A { | ||
for (x <- 1 to 5 ; y = x) yield x+y // ok | ||
for (x <- 1 to 5 ; val y = x) yield x+y // fail | ||
for (val x <- 1 to 5 ; y = x) yield x+y // fail | ||
for (val x <- 1 to 5 ; val y = x) yield x+y // fail | ||
|
||
for (z <- 1 to 2 ; x <- 1 to 5 ; y = x) yield x+y // ok | ||
for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // fail | ||
for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail | ||
for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail | ||
} |