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 #9580 from smarter/open-infix
Allow soft keywords `open` and `infix` under -Xsource:3
- Loading branch information
Showing
6 changed files
with
117 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
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,22 @@ | ||
open-infix-future.scala:4: error: expected class or object definition | ||
open trait A // error | ||
^ | ||
open-infix-future.scala:5: error: expected class or object definition | ||
open object B // error | ||
^ | ||
open-infix-future.scala:8: error: ';' expected but 'val' found. | ||
infix val a: Int = 1 // error | ||
^ | ||
open-infix-future.scala:9: error: ';' expected but 'var' found. | ||
infix var b: Int = 1 // error | ||
^ | ||
open-infix-future.scala:11: error: ';' expected but 'type' found. | ||
open type D // error | ||
^ | ||
open-infix-future.scala:14: error: illegal start of statement | ||
open class E // error | ||
^ | ||
open-infix-future.scala:15: error: ';' expected but 'def' found. | ||
open def bla(y: Int) = y // error | ||
^ | ||
7 errors |
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,17 @@ | ||
// scalac: -Xsource:3 | ||
// | ||
|
||
open trait A // error | ||
open object B // error | ||
|
||
class C { | ||
infix val a: Int = 1 // error | ||
infix var b: Int = 1 // error | ||
|
||
open type D // error | ||
|
||
def foo: Unit = { | ||
open class E // error | ||
open def bla(y: Int) = y // error | ||
} | ||
} |
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,36 @@ | ||
// scalac: -Xsource:3 | ||
// | ||
|
||
open class A | ||
infix class B[T, S] | ||
|
||
open infix class C[T, S] | ||
open infix case class CC[T, S](x: Int) | ||
infix open class D[T, S] | ||
infix trait DT[T, S] | ||
|
||
open | ||
infix | ||
private | ||
class E | ||
|
||
class F { | ||
open infix class C1[T, S] | ||
infix type X | ||
|
||
infix def foo(x: Int): Int = x | ||
} | ||
|
||
object G { | ||
open infix class C2[T, S] | ||
} | ||
|
||
object Test { | ||
val infix: Int = 1 | ||
infix + 1 | ||
val open: Int => Int = x => x | ||
open(1) | ||
open { | ||
2 | ||
} | ||
} |