Skip to content

Compiler crashes on inner class that extends sealed class #3149

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
allanrenucci opened this issue Sep 21, 2017 · 0 comments
Closed

Compiler crashes on inner class that extends sealed class #3149

allanrenucci opened this issue Sep 21, 2017 · 0 comments

Comments

@allanrenucci
Copy link
Contributor

sealed class Foo

class Test {
  def f = {
    class Bar extends Foo
  }
}
Stacktrace
exception occurred while compiling tests/allan/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: class Bar when pickling tests/allan/Test.scala
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:592)
	at dotty.tools.dotc.transform.Pickler.$anonfun$run$3(Pickler.scala:52)
	at dotty.tools.dotc.transform.Pickler.$anonfun$run$3$adapted(Pickler.scala:45)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at dotty.tools.dotc.transform.Pickler.$anonfun$run$2(Pickler.scala:45)
	at dotty.tools.dotc.transform.Pickler.$anonfun$run$2$adapted(Pickler.scala:44)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at dotty.tools.dotc.transform.Pickler.run(Pickler.scala:44)
	at dotty.tools.dotc.core.Phases$Phase.$anonfun$runOn$1(Phases.scala:288)
	at scala.collection.immutable.List.map(List.scala:283)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:286)
	at dotty.tools.dotc.core.Phases$Phase.runOn$(Phases.scala:285)
	at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:76)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:124)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:47)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:122)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:120)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:191)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:120)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:86)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:108)
	at dotty.tools.dotc.Run.compileSources(Run.scala:95)
	at dotty.tools.dotc.Run.compile(Run.scala:79)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:26)
	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.Main.main(Main.scala)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
	at scala.sys.package$.error(package.scala:27)
  

odersky added a commit to dotty-staging/dotty that referenced this issue Sep 28, 2017
i3149.scala is an interesting test case: A sealed top-level class `Foo`
has a child which is a local (i.e., term-owned) definition in a different top-level class.
It is then impossible to establish a symbolic reference to the child class
from `Foo`, and it is also impossible to refer to `Foo` using a path. We deal with this
by avoiding pickling such child annotations and re-establishing the annotation
when the body of the child class is unpickled.
odersky added a commit that referenced this issue Sep 29, 2017
Fix #3149: Fix pickling of child annotations to local classes
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