Skip to content

Crash when summoning mirror for match type aliased in separate compilation #20187

Closed
@EugeneFlesselle

Description

@EugeneFlesselle

Compiler version

3.5.0-RC1

Minimized code

A_1.scala

case class Foo()
type G = Foo
type F = Tuple.Head[Foo *: EmptyTuple]

B_2.scala

import scala.deriving.Mirror

def Test =
  summon[Mirror.Of[G]] // ok
  summon[Mirror.Of[F]] // crash

Output (click arrow to expand)

assertion failed
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
        at dotty.tools.dotc.typer.Synthesizer.companionPath(Synthesizer.scala:271)
        at dotty.tools.dotc.typer.Synthesizer.makeProductMirror$1(Synthesizer.scala:431)
        at dotty.tools.dotc.typer.Synthesizer.productMirror(Synthesizer.scala:470)
        at dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$6$$anonfun$1$$anonfun$1$$anonfun$1(Synthesizer.scala:601)
        at dotty.tools.dotc.typer.Synthesizer.makeMirror(Synthesizer.scala:593)
        at dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$6$$anonfun$1(Synthesizer.scala:601)
        at dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$8$$anonfun$1(Synthesizer.scala:613)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:754)
        at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:775)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:775)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:775)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:775)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:775)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:775)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:775)
        at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:756)
        at dotty.tools.dotc.typer.Synthesizer.tryAll(Synthesizer.scala:759)
        at dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:917)
        at dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:845)
        at dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:120)
        at dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3839)
        at dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3875)
        at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3954)
        at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4156)
        at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4407)
        at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3701)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1222)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3145)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1702)
        at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1692)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1702)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1958)
        at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1958)
        at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1966)
        at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1985)
        at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1986)
        at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1997)
        at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1740)
        at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1746)
        at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1845)
        at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:808)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:955)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:831)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:178)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:398)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:3084)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3109)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2814)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3125)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3129)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:503)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
        at dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
        at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
        at scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
        at scala.collection.immutable.List.prependedAll(List.scala:152)
        at scala.collection.immutable.List$.from(List.scala:684)
        at scala.collection.immutable.List$.from(List.scala:681)
        at scala.collection.IterableOps$WithFilter.map(Iterable.scala:898)
        at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:100)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:319)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:341)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:351)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:361)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:361)
[=======================================>] completed (1/1, 1 failed, 1s)
ls.dotc.Run.compileSources(Run.scala:262)
  | => sat dotty.tools.dotc.Run.compile(Run.scala:247)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.dotc.Driver.process(Driver.scala:199)
        at dotty.tools.dotc.Driver.process(Driver.scala:167)
        at dotty.tools.vulpix.ParallelTesting$Test.compile(ParallelTesting.scala:549)
        at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1$$anonfun$1(ParallelTesting.scala:236)
        at scala.collection.immutable.List.map(List.scala:250)
        at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1(ParallelTesting.scala:238)
        at scala.util.Try$.apply(Try.scala:210)
        at dotty.tools.vulpix.ParallelTesting$CompilationLogic.dotty$tools$vulpix$ParallelTesting$CompilationLogic$$compileTestSource(ParallelTesting.scala:239)
        at dotty.tools.vulpix.ParallelTesting$$anon$4.checkTestSource$$anonfun$1(ParallelTesting.scala:285)
        at dotty.tools.vulpix.ParallelTesting$$anon$4.checkTestSource$$anonfun$adapted$1(ParallelTesting.scala:288)
        at scala.Function0.apply$mcV$sp(Function0.scala:42)
        at dotty.tools.vulpix.ParallelTesting$Test.tryCompile(ParallelTesting.scala:472)
        at dotty.tools.vulpix.ParallelTesting$$anon$4.checkTestSource(ParallelTesting.scala:288)
        at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run(ParallelTesting.scala:368)
        at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run$(ParallelTesting.scala:350)
        at dotty.tools.vulpix.ParallelTesting$$anon$4.run(ParallelTesting.scala:283)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Compiles with everything in the same file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions