I found very strange issue with Scala import.
I wrote sample class:
package test_scala_predef
object App extends App {
classOf[T]
println( "Hello World!" )
}
class T {
}
This class compiles without any errors.
But, if I add
import scala.Predef.String
then I get compilation errors:
[INFO] Compiling 1 source files to /home/uthark/src/_/test_scala_predef/target/classes at 1374028063588
[ERROR] /home/uthark/src/_/test_scala_predef/src/main/scala/test_scala_predef/App.scala:10: error: not found: value classOf
[INFO] classOf[T]
[INFO] ^
[ERROR] /home/uthark/src/_/test_scala_predef/src/main/scala/test_scala_predef/App.scala:11: error: not found: value println
[INFO] println( "Hello World!" )
[INFO] ^
[ERROR] two errors found
I have an idea, that after I add specific import from scala.Predef
, then implict import of scala.Predef._
is not added. But I can't find anything about it in the Scala documentation. Can anyone point me to the relevant section in documentation?
I checked Scala Language Specification (PDF), section 12.5 covering scala.Predef
but also didn't find any related.
I use latest stable scala version available (2.10.2 at the moment)
I found the answer in the sources.
https://github.com/scala/scala/blob/master/src/compiler/scala/tools/nsc/typechecker/Contexts.scala:
This answers my question.
The key sentence is this:
Also, in chat on #scala irc it was suggested to create bug in Scala issue tracking system, so I did it. https://issues.scala-lang.org/browse/SI-7672