Scala Programming Language
  1. Scala Programming Language
  2. SI-6392

ToolBox throws exception for tb.eval(tb.parse("object C"))

    Details

      Description

      import reflect.runtime.universe._
      import scala.tools.reflect.ToolBox

      val tb = currentMirror.mkToolBox()
      tb.runExpr(tb.parseExpr("object C"))

      resulting in:

      scala.reflect.internal.FatalError:
      while compiling: <no file>
      during phase: typer
      library version: version 2.10.0-M7
      compiler version: version 2.10.0-M7
      reconstructed args:

      last tree to typer: term C
      symbol: <none> (flags: )
      symbol definition: <none>
      symbol owners:
      context owners:

      == Enclosing template or block ==

      ModuleDef(
      0
      "C"
      Template(
      "scala"."AnyRef" // parents
      ValDef(
      private
      "_"
      <tpt>
      <empty>
      )
      DefDef(
      0
      "<init>"
      []
      List(Nil)
      <tpt>
      Block(
      Apply(
      super."<init>"
      Nil
      )
      ()
      )
      )
      )
      )

      no-symbol does not have an owner
      at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:48)
      at scala.tools.nsc.Global.abort(Global.scala:246)
      at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3113)
      at scala.tools.nsc.typechecker.Namers$$anonfun$companionSymbolOf$1.apply(Namers.scala:1537)
      at scala.tools.nsc.typechecker.Namers$$anonfun$companionSymbolOf$1.apply(Namers.scala:1537)
      at scala.reflect.internal.Symbols$Symbol.orElse(Symbols.scala:2086)
      at scala.tools.nsc.typechecker.Namers$class.companionSymbolOf(Namers.scala:1536)
      at scala.tools.nsc.Global$$anon$1.companionSymbolOf(Global.scala:484)
      at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1683)
      at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5310)
      at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5410)
      at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5609)
      at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2081)
      at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5261)
      at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5410)
      at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2672)
      at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$53.apply(Typers.scala:2766)
      at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$53.apply(Typers.scala:2766)
      at scala.collection.immutable.List.loop$1(List.scala:164)
      at scala.collection.immutable.List.mapConserve(List.scala:180)
      at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2766)
      at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1789)
      at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$26.apply(Typers.scala:1697)
      at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$26.apply(Typers.scala:1697)
      at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:512)
      at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1696)
      at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5310)
      at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5410)
      at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2672)
      at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$53.apply(Typers.scala:2766)
      at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$53.apply(Typers.scala:2766)
      at scala.collection.immutable.List.loop$1(List.scala:164)
      at scala.collection.immutable.List.mapConserve(List.scala:180)
      at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2766)
      at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4993)
      at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5319)
      at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5410)
      at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5461)
      at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:98)
      at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:455)
      at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
      at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
      at scala.collection.Iterator$class.foreach(Iterator.scala:726)
      at scala.collection.AbstractIterator.foreach(Iterator.scala:1155)
      at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:90)
      at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1566)
      at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1540)
      at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal.compileExpr(ToolBoxFactory.scala:222)
      at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal.runExpr(ToolBoxFactory.scala:251)
      at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl.runExpr(ToolBoxFactory.scala:393)
      at .<init>(<console>:21)
      at .<clinit>(<console>)
      at .<init>(<console>:7)
      at .<clinit>(<console>)
      at $print(<console>)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:732)
      at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:981)
      at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:571)
      at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:602)
      at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:566)
      at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)
      at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)
      at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)
      at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)
      at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)
      at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)
      at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)
      at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
      at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
      at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
      at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
      at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83)
      at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
      at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
      at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

        Activity

        Hide
        Eugene Burmako added a comment -

        Promoting to critical since this casts a shadow at the core of the implementation strategy

        Show
        Eugene Burmako added a comment - Promoting to critical since this casts a shadow at the core of the implementation strategy
        Hide
        Grzegorz Kossakowski added a comment -
        Show
        Grzegorz Kossakowski added a comment - Fixed in https://github.com/scala/scala/pull/1358

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development