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

Crash in patmat with method in pattern #10090

Closed
scabug opened this issue Dec 5, 2016 · 1 comment · Fixed by scala/scala#7053
Closed

Crash in patmat with method in pattern #10090

scabug opened this issue Dec 5, 2016 · 1 comment · Fixed by scala/scala#7053

Comments

@scabug
Copy link

scabug commented Dec 5, 2016

As reported on the ML. Also SO.

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

scala> object X { implicit class Y(self: String) } // or object X { def Y(s: String): Int = 42 }
defined object X

scala> (null: Any) match { case X.Y.Z() => }
java.lang.NullPointerException
    at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$ScalacPatternExpander$class.applyMethodTypes(ScalacPatternExpanders.scala:65)
    at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.applyMethodTypes(ScalacPatternExpanders.scala:97)
    at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.apply(ScalacPatternExpanders.scala:136)
    at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.apply(ScalacPatternExpanders.scala:159)
    at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$ExtractorCall$.apply(MatchTranslation.scala:384)

or without parens a different crash:

scala> object X { implicit class Y(self: String) }
defined object X

scala> (null: Any) match { case X.Y.Z => }
java.lang.NullPointerException
    at scala.tools.nsc.ast.TreeInfo$ValueClass$$anonfun$valueUnbox$1.apply(TreeInfo.scala:45)
    at scala.tools.nsc.ast.TreeInfo$ValueClass$$anonfun$valueUnbox$1.apply(TreeInfo.scala:45)
    at scala.reflect.internal.SymbolTable.enteringPhase(SymbolTable.scala:235)
    at scala.tools.nsc.ast.TreeInfo$ValueClass$.valueUnbox(TreeInfo.scala:45)
    at scala.tools.nsc.ast.TreeInfo$ValueClass$Unbox$.unapply(TreeInfo.scala:50)
    at scala.tools.nsc.ast.TreeInfo$ValueClass$BoxAndUnbox$.unapply(TreeInfo.scala:63)
    at scala.tools.nsc.transform.PostErasure$PostErasureTransformer.transform(PostErasure.scala:37)
    at scala.tools.nsc.transform.PostErasure$PostErasureTransformer.transform(PostErasure.scala:22)
@scabug
Copy link
Author

scabug commented Dec 5, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10090?orig=1
Reporter: @som-snytt
Affected Versions: 2.11.8, 2.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants