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

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

Closed
scabug opened this issue Sep 18, 2012 · 3 comments
Closed

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

scabug opened this issue Sep 18, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Sep 18, 2012

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:
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: (flags: )
symbol definition:
symbol owners:
context owners:

== Enclosing template or block ==

ModuleDef(
0
"C"
Template(
"scala"."AnyRef" // parents
ValDef(
private
"_"


)
DefDef(
0
""
[]
List(Nil)

Block(
Apply(
super.""
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 .(:21)
at .()
at .(:7)
at .()
at $print()
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)

@scabug
Copy link
Author

scabug commented Sep 18, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6392?orig=1
Reporter: Sagie Davidovich (sagie.d)
Affected Versions: 2.10.0-M7
Other Milestones: 2.10.0

@scabug
Copy link
Author

scabug commented Sep 18, 2012

@xeno-by said:
Promoting to critical since this casts a shadow at the core of the implementation strategy

@scabug
Copy link
Author

scabug commented Sep 20, 2012

@gkossakowski said:
Fixed in scala/scala#1358

@scabug scabug closed this as completed Sep 20, 2012
@scabug scabug added this to the 2.10.0-M7 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants