Skip to content

Instantiating inner class in REPL #1782

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

Closed
felixmulder opened this issue Dec 11, 2016 · 2 comments
Closed

Instantiating inner class in REPL #1782

felixmulder opened this issue Dec 11, 2016 · 2 comments

Comments

@felixmulder
Copy link
Contributor

felixmulder commented Dec 11, 2016

scala> class Foo { class Bar {} }
defined class Foo
scala> new Foo 
val res1: Foo = Foo@42e99e4a
scala> new res1.Bar

Results in:

exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line9$object$$iw$$iw$Foo$Bar$$$outer#33482 in class Bar, defined in Period(19..33, run = 17), is referred to in run Period(33..33, run = 21), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@8f4ea7c] of class class dotty.tools.dotc.ast.Trees$Apply # 7191
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line9$object$$iw$$iw$Foo$Bar$$$outer#33482 in class Bar, defined in Period(19..33, run = 17), is referred to in run Period(33..33, run = 21), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@436813f3] of class class dotty.tools.dotc.ast.Trees$DefDef # 7201
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line9$object$$iw$$iw$Foo$Bar$$$outer#33482 in class Bar, defined in Period(19..33, run = 17), is referred to in run Period(33..33, run = 21), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@74fe5c40] of class class dotty.tools.dotc.ast.Trees$TypeDef # 7203
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line9$object$$iw$$iw$Foo$Bar$$$outer#33482 in class Bar, defined in Period(19..33, run = 17), is referred to in run Period(33..33, run = 21), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@3febb011] of class class dotty.tools.dotc.ast.Trees$TypeDef # 7205
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line9$object$$iw$$iw$Foo$Bar$$$outer#33482 in class Bar, defined in Period(19..33, run = 17), is referred to in run Period(33..33, run = 21), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@10e31a9a] of class class dotty.tools.dotc.ast.Trees$TypeDef # 7207
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line9$object$$iw$$iw$Foo$Bar$$$outer#33482 in class Bar, defined in Period(19..33, run = 17), is referred to in run Period(33..33, run = 21), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@131774fe] of class class dotty.tools.dotc.ast.Trees$PackageDef # 7208
Exception in thread "main" dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line9$object$$iw$$iw$Foo$Bar$$$outer#33482 in class Bar, defined in Period(19..33, run = 17), is referred to in run Period(33..33, run = 21)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:916)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:742)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:771)
	at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:387)
	at dotty.tools.dotc.core.Scopes$Scope.denotsNamed(Scopes.scala:119)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.membersNamed(SymDenotations.scala:1592)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1645)
	at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:445)
	at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:580)
	at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:414)
	at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:398)
	at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:398)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.member(Types.scala:397)
	at dotty.tools.dotc.transform.ExplicitOuter$.outerAccessor(ExplicitOuter.scala:207)
	at dotty.tools.dotc.transform.ExplicitOuter$.dotty$tools$dotc$transform$ExplicitOuter$$hasOuterParam(ExplicitOuter.scala:216)
	at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.addParam$extension(ExplicitOuter.scala:302)
	at dotty.tools.dotc.core.TypeErasure$.transformInfo(TypeErasure.scala:177)
	at dotty.tools.dotc.transform.Erasure.transform(Erasure.scala:71)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:797)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:600)
	at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:1446)
	at dotty.tools.dotc.core.Types$NamedType.denotAt(Types.scala:1420)
	at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:1408)
	at dotty.tools.dotc.ast.Trees$DenotingTree.denot(Trees.scala:237)
	at dotty.tools.dotc.ast.Trees$Tree.symbol(Trees.scala:148)
	at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:428)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1454)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1495)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:95)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1505)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1503)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1503)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1555)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1174)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1157)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1157)
	at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:485)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1442)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1493)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:95)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1505)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1503)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1503)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1527)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1543)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:544)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1256)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1204)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1204)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1445)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1493)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:95)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1505)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1503)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1503)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1527)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1543)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:544)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1256)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1204)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1204)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1445)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1493)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:95)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1505)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1503)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1503)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1527)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1543)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:544)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1256)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1204)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1204)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1445)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1493)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:95)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1505)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1503)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1503)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1527)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1543)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:544)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1360)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1347)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1347)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1483)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1495)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:95)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1505)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1503)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1503)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1555)
	at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:78)
	at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:276)
	at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:274)
	at scala.collection.immutable.List.map(List.scala:273)
	at dotty.tools.dotc.core.Phases$Phase$class.runOn(Phases.scala:274)
	at dotty.tools.dotc.transform.Erasure.runOn(Erasure.scala:30)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:75)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:72)
	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:72)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:66)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:66)
	at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:76)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:66)
	at dotty.tools.dotc.Run.compileSources(Run.scala:63)
	at dotty.tools.dotc.repl.CompilingInterpreter.compileSources(CompilingInterpreter.scala:195)
	at dotty.tools.dotc.repl.CompilingInterpreter$Request.compile(CompilingInterpreter.scala:404)
	at dotty.tools.dotc.repl.CompilingInterpreter.interpret(CompilingInterpreter.scala:220)
	at dotty.tools.dotc.repl.CompilingInterpreter.interpret(CompilingInterpreter.scala:216)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$2.apply(AmmoniteReader.scala:19)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$2.apply(AmmoniteReader.scala:19)
	at dotty.tools.dotc.repl.CompilingInterpreter.delayOutputDuring(CompilingInterpreter.scala:103)
	at dotty.tools.dotc.repl.AmmoniteReader.incompleteInput(AmmoniteReader.scala:19)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$1.applyOrElse(AmmoniteReader.scala:31)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$1.applyOrElse(AmmoniteReader.scala:29)
	at scala.PartialFunction$Lifted.apply(PartialFunction.scala:223)
	at scala.PartialFunction$Lifted.apply(PartialFunction.scala:219)
	at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1$$anonfun$apply$1.apply(Filter.scala:21)
	at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1$$anonfun$apply$1.apply(Filter.scala:21)
	at scala.collection.Iterator$$anon$11.next(Iterator.scala:370)
	at scala.collection.Iterator$class.find(Iterator.scala:802)
	at scala.collection.AbstractIterator.find(Iterator.scala:1202)
	at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1.apply(Filter.scala:21)
	at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1.apply(Filter.scala:21)
	at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readChar$1(Terminal.scala:267)
	at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readLine(Terminal.scala:299)
	at dotty.tools.dotc.repl.AmmoniteReader.readLine(AmmoniteReader.scala:54)
	at dotty.tools.dotc.repl.InterpreterLoop.repl$default$1(InterpreterLoop.scala:75)
	at dotty.tools.dotc.repl.InterpreterLoop.repl(InterpreterLoop.scala:81)
	at dotty.tools.dotc.repl.InterpreterLoop.run(InterpreterLoop.scala:202)
	at dotty.tools.dotc.repl.REPL.doCompile(REPL.scala:43)
	at dotty.tools.dotc.Driver.process(Driver.scala:124)
	at dotty.tools.dotc.Driver.process(Driver.scala:93)
	at dotty.tools.dotc.Driver.process(Driver.scala:105)
	at dotty.tools.dotc.Driver.main(Driver.scala:132)
	at dotty.tools.dotc.repl.Main.main(Main.scala)
@felixmulder
Copy link
Contributor Author

Works fine using dotc

@odersky
Copy link
Contributor

odersky commented Dec 16, 2016

I think #1806 is a duplicate of this one. It's fixed in #1813.

@odersky odersky closed this as completed Dec 16, 2016
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