scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

interpreter gets errors defining vals with literal identifiers #769

Closed scabug closed 13 years ago

scabug commented 16 years ago

Running 2.7.0-final scala interpreter on Windows XP and Java 1.6.0, trying to define a val with a literal identifier name foo bar fails:

scala> val `bar foo` = 2
<console>:4: error: ')' expected but '.' found.
"" + "bar foo: Int = " +  (if(bar foo.asInstanceOf[AnyRef] != null)  ((if(bar foo.toString.contains('\n'))  "\n" else "") + bar foo.toString + "\n") else "null\n") }
                                                           ^
<console>:4: error: illegal start of simple expression
"" + "bar foo: Int = " +  (if(bar foo.asInstanceOf[AnyRef] != null)  ((if(bar foo.toString.contains('\n'))  "\n" else "") + bar foo.toString + "\n") else "null\n") }
                                                                                                                                                                                                                                      ^

scala> `bar foo` + 1
<console>:5: error: not found: value bar foo
       `bar foo` + 1
       ^

(It seems there should be a Trac component for the Interperter. There is not, so I used Compiler.)

scabug commented 16 years ago

Imported From: https://issues.scala-lang.org/browse/SI-769?orig=1 Reporter: @DavidBiesack Assignee: Geoffrey Alan Washburn (washburn)

scabug commented 16 years ago

Geoffrey Alan Washburn (washburn) said: Fixed in r14866

scabug commented 15 years ago

@odersky said: Milestone next_bugfix deleted