Aladdin - Scala Bugtracking
[#626] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Gilles fixed 2006-06-15 15:00:55.0
subject no staging for valdefs
code
object Foo {
  val x: reflect.Code[() => Unit] = () => { val z = null; () }
}
what happened
[emir@lamppc31 /tmp]$ scalac -d . staging1.scala
Exception in thread "main" scala.tools.nsc.symtab.Types$TypeError: cannot reify tree: val z: scala.AllRef = null\

        at scala.tools.nsc.transform.LiftCode$Reifier.reify(LiftCode.scala:107)
        at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$7.apply(LiftCode.scala:94)
        at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$7.apply(LiftCode.scala:94)
        at scala.List.map(List.scala:652)
        at scala.tools.nsc.transform.LiftCode$Reifier.reify(LiftCode.scala:94)
        at scala.tools.nsc.transform.LiftCode$Reifier.reify(LiftCode.scala:90)
        at scala.tools.nsc.transform.LiftCode.reify(LiftCode.scala:220)
        at scala.tools.nsc.transform.LiftCode.codify(LiftCode.scala:226)
        at scala.tools.nsc.transform.LiftCode$AddRefFields.transform(LiftCode.scala:31)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$15.apply(Trees.scala:938)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$15.apply(Trees.scala:938)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1044)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:937)
        at scala.tools.nsc.transform.LiftCode$AddRefFields.transform(LiftCode.scala:33)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$25.apply(Trees.scala:1038)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$25.apply(Trees.scala:1036)
        at scala.List$.loop$0(List.scala:232)
        at scala.List$.mapConserve(List.scala:249)
        at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1036)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:962)
        at scala.tools.nsc.transform.LiftCode$AddRefFields.transform(LiftCode.scala:33)
        at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1024)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$13.apply(Trees.scala:930)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$13.apply(Trees.scala:930)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1044)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:929)
        at scala.tools.nsc.transform.LiftCode$AddRefFields.transform(LiftCode.scala:33)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$25.apply(Trees.scala:1038)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$25.apply(Trees.scala:1036)
        at scala.List$.loop$0(List.scala:232)
        at scala.List$.mapConserve(List.scala:249)
        at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1036)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$12.apply(Trees.scala:926)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$12.apply(Trees.scala:926)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1044)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:925)
        at scala.tools.nsc.transform.LiftCode$AddRefFields.transform(LiftCode.scala:33)
        at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1039)
        at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:22)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:215)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:204)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:204)
        at scala.Iterator$class.foreach(Iterator.scala:304)
        at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:216)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:204)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:455)
        at scala.tools.nsc.Global$Run.compile(Global.scala:514)
        at scala.tools.nsc.Main$.process(Main.scala:60)
        at scala.tools.nsc.Main$.main(Main.scala:82)
        at scala.tools.nsc.Main.main(Main.scala)
what expected code for valdefs
[back to overview]
Changes of this bug report
Burak  edited on  2006-06-17 17:40:30.0
added it myself, was easy thanks to Gilles's well-structured code.