Skip to content

Compiler crash – a corner case with non-existing types and summoning #7387

Closed
@anatoliykmetyuk

Description

@anatoliykmetyuk
type E = A.B { type C = D }
def g = summon[E]

A, B and D do not exist.

Compile it:

Crash
-- [E006] Unbound Identifier Error: /Users/anatolii/Projects/dotty/pg/i3/Macros_1.scala:1:9
1 |type E = A.B { type C = D }
  |         ^
  |         Not found: A

longer explanation available when compiling with `-explain`
exception occurred while typechecking /Users/anatolii/Projects/dotty/pg/i3/Macros_1.scala
exception occurred while compiling /Users/anatolii/Projects/dotty/pg/i3/Macros_1.scala
scala.MatchError: NoType (of class dotty.tools.dotc.core.Types$NoType$) while compiling /Users/anatolii/Projects/dotty/pg/i3/Macros_1.scala
Exception in thread "main" scala.MatchError: NoType (of class dotty.tools.dotc.core.Types$NoType$)
	at dotty.tools.dotc.core.TypeComparer.ensureStableSingleton(TypeComparer.scala:1488)
	at dotty.tools.dotc.core.TypeComparer.compareRec$1(TypeComparer.scala:553)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:556)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:443)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:354)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1069)
	at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:235)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:279)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1069)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:159)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:169)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:126)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:853)
	at dotty.tools.dotc.typer.Implicits.trySpecialCases$1(Implicits.scala:1108)
	at dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:1117)
	at dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.implicitArgs$2(Typer.scala:2555)
	at dotty.tools.dotc.typer.Typer.addImplicitArgs$4(Typer.scala:2578)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$2(Typer.scala:2645)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2816)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3044)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2450)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2151)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2163)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1202)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1192)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1202)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1337)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1348)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1349)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1360)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1368)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1437)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:770)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:887)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:797)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:257)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:182)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:184)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:397)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2011)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2036)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2114)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2151)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2163)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2182)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2226)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1725)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2049)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2114)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2151)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2163)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2182)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2226)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1850)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2090)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2115)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2151)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2163)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2239)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:76)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:41)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:80)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:110)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:305)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:110)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:159)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:169)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:177)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:184)
	at dotty.tools.dotc.Run.compileSources(Run.scala:121)
	at dotty.tools.dotc.Run.compile(Run.scala:104)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:178)
	at dotty.tools.dotc.Driver.process(Driver.scala:147)
	at dotty.tools.dotc.Driver.process(Driver.scala:159)
	at dotty.tools.dotc.Driver.main(Driver.scala:186)
	at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions