Skip to content
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

NullPointException when putting a Singleton type in an AnyVal #11659

Open
Atry opened this issue Aug 3, 2019 · 0 comments

Comments

@Atry
Copy link

commented Aug 3, 2019

Welcome to Scala 2.13.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_202-ea).
Type in expressions for evaluation. Or try :help.

scala> class Foo[S <: AnyRef](val s: S) extends AnyVal
defined class Foo

scala> def Foo[S <: AnyRef](name: S) = new Foo[name.type](name)
Foo: [S <: AnyRef](name: S)Foo[name.type]

scala> Foo("xx")
java.lang.NullPointerException
  at Foo$.hashCode$extension(<console>:1)
  at Foo.hashCode(<console>:1)
  at java.lang.Object.toString(Object.java:236)
  at scala.runtime.ScalaRunTime$.inner$1(ScalaRunTime.scala:238)
  at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:243)
  at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:251)
  at .$print$lzycompute(<synthetic>:8)
  ... 26 elided

@hrhino hrhino added this to the Backlog milestone Aug 4, 2019

@hrhino hrhino added the repl label Aug 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.