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

Two crashers for reify/patmat #5710

Closed
scabug opened this issue Apr 25, 2012 · 8 comments
Closed

Two crashers for reify/patmat #5710

scabug opened this issue Apr 25, 2012 · 8 comments

Comments

@scabug
Copy link

scabug commented Apr 25, 2012

One during macro expansion, one in genicode.

object Test {
  def main(args: Array[String]): Unit = {
    // #1
    scala.reflect.mirror.reify({ val (x, y) = ("abc": Any) match { case x => (x, x) } })
    // ./a.scala:3: error: exception during macro expansion: 
    // scala.MatchError: ("abc": Any) (of class scala.reflect.api.Trees$Typed)
    //  at scala.reflect.reify.phases.Reshape$$anon$1.toPreTyperTypedOrAnnotated(Reshape.scala:157)
    //  at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:35)
    //  at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1502)
    //  at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:85)
    //  at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1534)
    //  at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:85)
    //  at scala.reflect.api.Trees$Transformer$$anonfun$transform$4.apply(Trees.scala:1458)
    //  at scala.reflect.api.Trees$Transformer$$anonfun$transform$4.apply(Trees.scala:1457)
    
    // #2
    scala.reflect.mirror.reify({ val (x, y) = "abc" match { case x => (x, x) } })
    // error: symbol value x$2 does not exist in Test.main
    // error: 
    //      while compiling:  ./a.scala
    //        current phase:  icode
    //      library version:  version 2.10.0-20120425-102722-4c1d2e9827
    //     compiler version:  version 2.10.0-20120425-102722-4c1d2e9827
    //   reconstructed args:  
    // 
    // uncaught exception during compilation: scala.reflect.internal.FatalError
    // error: scala.reflect.internal.FatalError: 
    //      while compiling:  ./a.scala
    //        current phase:  icode
    //      library version:  version 2.10.0-20120425-102722-4c1d2e9827
    //     compiler version:  version 2.10.0-20120425-102722-4c1d2e9827
    //   reconstructed args:  
    // 
    // symbol value x$2 does not exist in Test.main
    //  at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:45)
    //  at scala.tools.nsc.Global.abort(Global.scala:202)
    //  at scala.tools.nsc.backend.icode.GenICode$ICodePhase.liftedTree2$1(GenICode.scala:998)
    //  at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:992)
  }
}
@scabug
Copy link
Author

scabug commented Apr 25, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5710?orig=1
Reporter: @paulp
Affected Versions: 2.10.0
See #5694

@scabug
Copy link
Author

scabug commented Nov 26, 2012

@xeno-by said:
The second one is no longer crashing.

@scabug
Copy link
Author

scabug commented Nov 26, 2012

@xeno-by said:
The issue is being fixed.

@scabug
Copy link
Author

scabug commented Feb 9, 2013

Evgeny Kotelnikov (aztek) said:
The first one seems to boil down to the case, where both bound type and annotation are used with the same variable. This is the case with val (x, y) construct, that is desugared as pattern matching with @scala.unchecked annotation.

I get a similar error message with simple

val x = ("a": String): @deprecated

@scabug
Copy link
Author

scabug commented Mar 4, 2013

Evgeny Kotelnikov (aztek) said:
The first one is no longer crashing as well.

@scabug
Copy link
Author

scabug commented Mar 4, 2013

@xeno-by said:
"No longer" = "no longer crashes in master" or "no longer crashed in 2.10.x"?

@scabug
Copy link
Author

scabug commented Mar 4, 2013

Evgeny Kotelnikov (aztek) said:
The former. Haven't tried for 2.10.x, though.

@scabug
Copy link
Author

scabug commented Mar 9, 2013

@xeno-by said:
scala/scala#2221

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

No branches or pull requests

2 participants