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
NullPointerException in REPL when a type and an singleton object share name under a package #4991
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4991?orig=1 |
@som-snytt said: Under separate compilation of a client using 2.10, scalac emits the same class file error; but compiling together works. # footnote, 2.9.1 is unhappy compiling pkg obj after 2.10 without cleaning
$ scalac t4991.scala
??? base trait ScalaObject not found in basetypes of object t4991
# 2.10
$ spala
Welcome to Scala version 2.10.0-20120501-234146-b27abca41a (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
scala> t4991.Foo.bar
error: error while loading Foo, class file '.\t4991\Foo.class' contains wrong class Int
scala> import t4991._
import t4991._
scala> import Foo._
<console>:10: error: erroneous or inaccessible type
import Foo._
^ |
@paulp said: |
@adriaanm said (edited on May 8, 2012 3:20:57 PM UTC): synonymous class and type alias in the same scope is not allowed -- can we delay creating the class symbol without knowing we need to? object and type alias should be allowed to co-exist (however, class and type alias is not allowed) |
Duplicate was fixed. |
The following code compiles, but gives NullPointerException when foo.Foo.bar is called in REPL.
Running "println(foo.Foo.bar)" as a single Scala script gives the correct result and does not crash the compiler.
The text was updated successfully, but these errors were encountered: