-
-
Save xuwei-k/ff56b005df0d87a8419421238f719d74 to your computer and use it in GitHub Desktop.
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
$ scala -Xsource:3 | |
Welcome to Scala 2.13.13 -Xsource:3.0.0 (OpenJDK 64-Bit Server VM, Java 1.8.0_392). | |
Type in expressions for evaluation. Or try :help. | |
scala> def f = { | |
| val x: Boolean = ??? | |
| | |
| x | |
| && x | |
| } | |
| | |
&& x | |
^ | |
On line 5: error: not found: value && | |
&& x | |
^ | |
On line 5: error: postfix operator x needs to be enabled | |
by making the implicit value scala.language.postfixOps visible. | |
This can be achieved by adding the import clause 'import scala.language.postfixOps' | |
or by setting the compiler option -language:postfixOps. | |
See the Scaladoc for value scala.language.postfixOps for a discussion | |
why the feature needs to be explicitly enabled. | |
Line starts with an operator that in future | |
will be taken as an infix expression continued from the previous line. | |
To force the previous interpretation as a separate statement, | |
add an explicit `;`, add an empty line, or remove spaces after the operator. | |
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
$ scala -Xsource:3-cross | |
Welcome to Scala 2.13.13 -Xsource:3-cross (OpenJDK 64-Bit Server VM, Java 1.8.0_392). | |
Type in expressions for evaluation. Or try :help. | |
scala> def f = { | |
| val x: Boolean = ??? | |
| | |
| x | |
| && x | |
| } | |
| | |
def f: Boolean |
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
$ scala | |
Welcome to Scala 2.13.13 (OpenJDK 64-Bit Server VM, Java 1.8.0_392). | |
Type in expressions for evaluation. Or try :help. | |
scala> def f = { | |
| val x: Boolean = ??? | |
| | |
| x | |
| && x | |
| } | |
| | |
&& x | |
^ | |
On line 5: error: not found: value && | |
&& x | |
^ | |
On line 5: error: postfix operator x needs to be enabled | |
by making the implicit value scala.language.postfixOps visible. | |
This can be achieved by adding the import clause 'import scala.language.postfixOps' | |
or by setting the compiler option -language:postfixOps. | |
See the Scaladoc for value scala.language.postfixOps for a discussion | |
why the feature needs to be explicitly enabled. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment