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

can't reify pattern match under virtpatmat #5694

Closed
scabug opened this issue Apr 22, 2012 · 4 comments
Closed

can't reify pattern match under virtpatmat #5694

scabug opened this issue Apr 22, 2012 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Apr 22, 2012

(This seems a pretty basic problem, sorry if it is a duplicate report.)

   ~/code/scala ./build/quick/bin/scala
Welcome to Scala version 2.10.0-20120422-061223-8c95273b70 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.

scala> reify { 1 match { case 0 => 0 } }
<console>:8: error: not found: value reify
              reify { 1 match { case 0 => 0 } }
              ^

scala> import reflect.mirror._
import reflect.mirror._

scala> reify { 1 match { case 0 => 0 } }
ReplGlobal.abort: symbol value x does not exist in $line5.$read$$iw$$iw$$iw$$iw$$anonfun$1.apply$mcI$sp
error: symbol value x does not exist in $anonfun$1.apply$mcI$sp
error: 
     while compiling:  <console>
       current phase:  icode
     library version:  version 2.10.0-20120422-061223-8c95273b70
    compiler version:  version 2.10.0-20120422-061223-8c95273b70
  reconstructed args:  

uncaught exception during compilation: scala.reflect.internal.FatalError
scala.reflect.internal.FatalError: 
     while compiling:  <console>
       current phase:  icode
     library version:  version 2.10.0-20120422-061223-8c95273b70
    compiler version:  version 2.10.0-20120422-061223-8c95273b70
  reconstructed args:  

symbol value x does not exist in $line5.$read$$iw$$iw$$iw$$iw$$anonfun$1.apply$mcI$sp
	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:45)
	at scala.tools.nsc.Global.abort(Global.scala:202)
	at scala.tools.nsc.interpreter.IMain$$anon$1.scala$tools$nsc$interpreter$ReplGlobal$$super$abort(IMain.scala:289)
	at scala.tools.nsc.interpreter.ReplGlobal$class.abort(ReplGlobal.scala:21)
	at scala.tools.nsc.interpreter.IMain$$anon$1.abort(IMain.scala:289)
	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)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:116)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:77)

Under the old regime:

 ~/code/scala ./build/quick/bin/scala -Xoldpatmat
Welcome to Scala version 2.10.0-20120422-061223-8c95273b70 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import reflect.mirror._
import reflect.mirror._

scala> reify { 1 match { case 0 => 0 } }
res0: reflect.mirror.Expr[Int] = 
Expr[Int](1 match {
  case 0 => 0
})
@scabug
Copy link
Author

scabug commented Apr 22, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5694?orig=1
Reporter: @retronym

@scabug
Copy link
Author

scabug commented May 3, 2012

@magarciaEPFL said:

Doesn't crash anymore, the reified tree corresponds to the desugared Match.

Jason, what do you think, good enough? (I guess so, because #5272 has been FIXED).

C:\scala>build\quick\bin\scala
Welcome to Scala version 2.10.0-20120502-222338-24be606216 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import reflect.mirror._
import reflect.mirror._

scala> reify { 1 match { case 0 => 0 } }
res1: reflect.mirror.Expr[Int] =
Expr[Int]({
  case <synthetic> val x1 = 1;
  case4(){
    if (0.$eq$eq(x1))
      {
        val x2 = x1;
        matchEnd3(0)
      }
    else
      case5()
  };
  case5(){
    matchEnd3(throw new <type ?>(x1))
  };
  matchEnd3(x){
    x
  }
})

@scabug
Copy link
Author

scabug commented May 3, 2012

@retronym said (edited on May 3, 2012 8:06:32 PM UTC):
I'll leave the judgement of fixed-ness to Eugene, but it is certainly an improvement over the crash.

@scabug
Copy link
Author

scabug commented Jun 9, 2012

@xeno-by said:
Fixed in scala/scala@6355d1a

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