Skip to content

Undefined type and AssertionError: class has non-class parent ErrorType #5449

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
panacekcz opened this issue Nov 15, 2018 · 0 comments
Closed

Comments

@panacekcz
Copy link
Contributor

Def.scala:

class A[T]
class B extends A[C]
class C extends B

Use.scala

class D[U <: B] extends C

First, dotc Def.scala succeeds.
Then, compiling dotc -classpath . Use.scala:

undefined: new B # 103: TermRef(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),module class <empty>)),B),<init>) at frontend
exception occurred while typechecking Use.scala
exception occurred while compiling Use.scala
java.lang.AssertionError: assertion failed: class C has non-class parent: dotty.tools.dotc.core.Types$ErrorType$$anon$1@907f2b7 while compiling Use.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: class C has non-class parent: dotty.tools.dotc.core.Types$ErrorType$$anon$1@907f2b7
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.$anonfun$computeBaseData$1(SymDenotations.scala:1523)
	at scala.collection.immutable.List.foreach(List.scala:388)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1520)
	at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2243)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1501)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1512)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:1532)
	at dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:208)
	at dotty.tools.dotc.core.Types$Type.derivesFrom(Types.scala:224)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:889)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$completeInCreationContext$5(Namer.scala:936)
	at scala.collection.immutable.List.map(List.scala:282)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:936)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:739)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:232)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:180)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:182)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:338)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1841)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1866)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1942)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1974)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1970)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1986)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2005)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2038)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedPackageDef$1(Typer.scala:1715)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1708)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1921)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1943)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1974)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1970)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1986)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2049)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$typeCheck$1(FrontEnd.scala:60)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:34)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:58)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$6(FrontEnd.scala:88)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$6$adapted(FrontEnd.scala:88)
	at scala.collection.immutable.List.foreach(List.scala:388)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:88)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:172)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:49)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:169)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:167)
	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:194)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:167)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:192)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:90)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:147)
	at dotty.tools.dotc.Run.compileSources(Run.scala:134)
	at dotty.tools.dotc.Run.compile(Run.scala:118)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:30)
	at dotty.tools.dotc.Driver.process(Driver.scala:136)
	at dotty.tools.dotc.Driver.process(Driver.scala:105)
	at dotty.tools.dotc.Driver.process(Driver.scala:117)
	at dotty.tools.dotc.Driver.main(Driver.scala:144)
	at dotty.tools.dotc.Main.main(Main.scala)

Possibly related: #3625

smarter added a commit to dotty-staging/dotty that referenced this issue Nov 22, 2018
Otherwise we may try to unpickle references to these definitions
before they've been indexed (this manifests itself as "undefined: ..."
error messages)
smarter added a commit to dotty-staging/dotty that referenced this issue Nov 22, 2018
Otherwise we may try to unpickle references to these definitions before
we have symbols for them (this manifests itself as "undefined: ..."
error messages)
odersky added a commit that referenced this issue Nov 23, 2018
Fix #5449: Index class definitions before unpickling parents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant