Closed taisukeoe closed 9 years ago
This is not a bug. Or if it is, it's not my bug. That is perfectly valid Scala:
scala> object de{ var i = 0 }
defined object de
scala> object A{ de i: Int = 1 }
<console>:1: error: ';' expected but '=' found.
object A{ de i: Int = 1 }
^
scala> object A{ de i = 1 }
warning: there was one feature warning; re-run with -feature for details
defined object A
scala> de.i
res1: Int = 0
scala> A
res2: A.type = A$@2b4ad817
scala> de.i
res3: Int = 1
I got it. Thanks.
I happen to find bugs about syntax error reporting of typo on
def
,val
orvar
, which are not occurred if method or variable doesn't have type annotation. I assume they should be reported as syntax error even if they're not type annotatedHere are examples of method with typo on
def
. Behavior of variable with typo onval
orvar
is the same.