New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't refer to variable with symbolic name without explicit prefix #1696
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1696?orig=1 |
@paulp said: |
@paulp said: scala> val & = "abc"
&: java.lang.String = abc
scala> &
res0: java.lang.String = abc
scala> val x = &
x: java.lang.String = abc But ! doesn't, and with backticks at least it really should: scala> val ! = 5
!: Int = 5
scala> !
| ;
<console>:2: error: illegal start of simple expression
;
^
scala> val x = !;
<console>:1: error: illegal start of simple expression
val x = !;
^
scala> val x = `!`;
<console>:1: error: illegal start of simple expression
val x = `!`;
^
scala> val `!` = 10
!: Int = 10 This works in a pinch: scala> $$bang
res2: Int = 10
scala> val p = $$bang
p: Int = 10 Lowering priority. |
@LilyLambda said: object Tilde {
val ~ = 5
println(~)
} yuvi@types$ scalac Tilde.scala
Tilde.scala:3: error: illegal start of simple expression
println(~)
^
Tilde.scala:4: error: ')' expected but '}' found.
}
^
two errors found yuvi@types$ scalac -version
Scala compiler version 2.9.0.1 -- Copyright 2002-2011, LAMP/EPFL |
@paulp said:
|
@LilyLambda said: |
@paulp said: |
@jrudolph said: E.g. what should be the meaning of val + = 12
+ + + // should that mean (+).+(+) or the invalid (+ +).+ |
@LilyLambda said: |
@adriaanm said: scala> object foo { object ~ }
defined module foo
scala> foo.~
res4: foo.~.type = foo$$tilde$@560e018a Community, feel free to reopen (preferable with a pull request in hand). |
@som-snytt said: The triple plus is not invalid: scala> val + = 12
+: Int = 12
scala> + + +
<console>:9: error: ambiguous reference to overloaded definition,
both method + in class Int of type (x: Char)Int
and method + in class Int of type (x: Byte)Int
match expected type ?
+ + +
^
scala> val f: Int => Int = + + +
warning: there was one feature warning; re-run with -feature for details
f: Int => Int = <function1> The rule is that it takes the first plus in the traditional way if it can. |
(Assigning to myself, ticket for my reference.)
The text was updated successfully, but these errors were encountered: