Details

      Description

      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)
        }
      }
      

        Issue Links

          Activity

          Hide
          Eugene Burmako added a comment -

          The second one is no longer crashing.

          Show
          Eugene Burmako added a comment - The second one is no longer crashing.
          Hide
          Eugene Burmako added a comment -

          The issue is being fixed.

          Show
          Eugene Burmako added a comment - The issue is being fixed.
          Hide
          Evgeny Kotelnikov added a comment -

          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
          
          Show
          Evgeny Kotelnikov added a comment - 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
          Hide
          Evgeny Kotelnikov added a comment -

          The first one is no longer crashing as well.

          Show
          Evgeny Kotelnikov added a comment - The first one is no longer crashing as well.
          Hide
          Eugene Burmako added a comment -

          "No longer" = "no longer crashes in master" or "no longer crashed in 2.10.x"?

          Show
          Eugene Burmako added a comment - "No longer" = "no longer crashes in master" or "no longer crashed in 2.10.x"?
          Hide
          Evgeny Kotelnikov added a comment -

          The former. Haven't tried for 2.10.x, though.

          Show
          Evgeny Kotelnikov added a comment - The former. Haven't tried for 2.10.x, though.
          Show
          Eugene Burmako added a comment - https://github.com/scala/scala/pull/2221

            People

            • Assignee:
              Eugene Burmako
              Reporter:
              Paul Phillips
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development