scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.89k stars 1.06k forks source link

Compiler crash using F-bounded polymorphism and typeclass derivation #18670

Open PawkyPenguin opened 1 year ago

PawkyPenguin commented 1 year ago

Compiler version

3.3.1

Minimized code

import upickle.default.ReadWriter

abstract class Payload[A <: Payload[A]: ReadWriter]() {
  def pickle = upickle.default.write(this.asInstanceOf[A])
}

case class Summary() extends Payload()

The code is deceptively small, but unfortunately it uses lihaoyi's upickle and I could not minimize it out. So far I was not able to reproduce the error by simply writing my own typeclass trait ReadWriter[A] and I don't know enough about mirrors to look into and understand what is happening in the upickle source code. Sorry!

sbt build

ThisBuild / scalaVersion := "3.3.1"

lazy val root = project.in(file(".")).settings(
  libraryDependencies ++= Seq( "com.lihaoyi" %% "upickle" % "3.1.0")
)

Output (click arrow to expand)

```scala [error] java.lang.Error: internal error: type of Mirror.*Of argument T is not fully defined, pos = compilerBug.scala:7 [error] dotty.tools.dotc.typer.Inferencing$.fullyDefinedType(Inferencing.scala:46) [error] dotty.tools.dotc.typer.Synthesizer.makeMirror(Synthesizer.scala:575) [error] dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$6$$anonfun$1(Synthesizer.scala:585) [error] dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:738) [error] dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] dotty.tools.dotc.typer.Synthesizer.tryAll(Synthesizer.scala:743) [error] dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:890) [error] dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:818) [error] dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:116) [error] dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3737) [error] dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3773) [error] dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3849) [error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4038) [error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4268) [error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] dotty.tools.dotc.typer.Typer.readapt$1(Typer.scala:3598) [error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4255) [error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] dotty.tools.dotc.typer.Implicits.typedImplicit(Implicits.scala:1117) [error] dotty.tools.dotc.typer.Implicits.typedImplicit$(Implicits.scala:818) [error] dotty.tools.dotc.typer.Typer.typedImplicit(Typer.scala:116) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.tryImplicit(Implicits.scala:1242) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.rank$1(Implicits.scala:1341) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1511) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1539) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1547) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1572) [error] dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1060) [error] dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:818) [error] dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:116) [error] dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:884) [error] dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:818) [error] dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:116) [error] dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3737) [error] dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3773) [error] dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3849) [error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4038) [error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4268) [error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] dotty.tools.dotc.typer.Typer.readapt$1(Typer.scala:3598) [error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4255) [error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] dotty.tools.dotc.typer.Implicits.typedImplicit(Implicits.scala:1117) [error] dotty.tools.dotc.typer.Implicits.typedImplicit$(Implicits.scala:818) [error] dotty.tools.dotc.typer.Typer.typedImplicit(Typer.scala:116) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.tryImplicit(Implicits.scala:1242) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.rank$1(Implicits.scala:1341) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1511) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1539) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1547) [error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1572) [error] dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1060) [error] dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:818) [error] dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:116) [error] dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:884) [error] dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:818) [error] dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:116) [error] dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3737) [error] dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3773) [error] dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3849) [error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4038) [error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4268) [error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188) [error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300) [error] dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1653) [error] dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1643) [error] dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1653) [error] dotty.tools.dotc.typer.Namer$ClassCompleter.typedParentApplication$1(Namer.scala:1489) [error] dotty.tools.dotc.typer.Namer$ClassCompleter.parentType$1(Namer.scala:1509) [error] dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:1519) [error] dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$29(Namer.scala:1592) [error] scala.collection.immutable.List.map(List.scala:246) [error] dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1592) [error] dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:814) [error] dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:174) [error] dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187) [error] dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189) [error] dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393) [error] dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2989) [error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3014) [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188) [error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210) [error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256) [error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2812) [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3081) [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184) [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188) [error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300) [error] dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44) [error] dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54) [error] scala.Function0.apply$mcV$sp(Function0.scala:42) [error] dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:440) [error] dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54) [error] dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88) [error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) [error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) [error] scala.collection.immutable.List.foreach(List.scala:333) [error] dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88) [error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246) [error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) [error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) [error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321) [error] dotty.tools.dotc.Run.runPhases$1(Run.scala:262) [error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270) [error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279) [error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67) [error] dotty.tools.dotc.Run.compileUnits(Run.scala:279) [error] dotty.tools.dotc.Run.compileSources(Run.scala:194) [error] dotty.tools.dotc.Run.compile(Run.scala:179) [error] dotty.tools.dotc.Driver.doCompile(Driver.scala:37) [error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) [error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) [error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) [error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192) [error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) [error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247) [error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182) [error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) [error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) [error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) [error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210) [error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528) [error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528) [error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177) [error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175) [error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461) [error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) [error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) [error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) [error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) [error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416) [error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503) [error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403) [error] sbt.internal.inc.Incremental$.apply(Incremental.scala:169) [error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528) [error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482) [error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) [error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420) [error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) [error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2366) [error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2316) [error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30) [error] sbt.internal.io.Retry$.apply(Retry.scala:46) [error] sbt.internal.io.Retry$.apply(Retry.scala:28) [error] sbt.internal.io.Retry$.apply(Retry.scala:23) [error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30) [error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2314) [error] scala.Function1.$anonfun$compose$1(Function1.scala:49) [error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) [error] sbt.std.Transform$$anon$4.work(Transform.scala:68) [error] sbt.Execute.$anonfun$submit$2(Execute.scala:282) [error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) [error] sbt.Execute.work(Execute.scala:291) [error] sbt.Execute.$anonfun$submit$1(Execute.scala:282) [error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) [error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64) [error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [error] java.base/java.lang.Thread.run(Thread.java:833) [error] [error] java.lang.Error: internal error: type of Mirror.*Of argument T is not fully defined, pos = compilerBug.scala:7 [error] at dotty.tools.dotc.typer.Inferencing$.fullyDefinedType(Inferencing.scala:46) [error] at dotty.tools.dotc.typer.Synthesizer.makeMirror(Synthesizer.scala:575) [error] at dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$6$$anonfun$1(Synthesizer.scala:585) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:738) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1$$anonfun$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer$.dotty$tools$dotc$typer$Synthesizer$$$orElse(Synthesizer.scala:759) [error] at dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:740) [error] at dotty.tools.dotc.typer.Synthesizer.tryAll(Synthesizer.scala:743) [error] at dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:890) [error] at dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:818) [error] at dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:116) [error] at dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3737) [error] at dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3773) [error] at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3849) [error] at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4038) [error] at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4268) [error] at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] at dotty.tools.dotc.typer.Typer.readapt$1(Typer.scala:3598) [error] at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4255) [error] at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] at dotty.tools.dotc.typer.Implicits.typedImplicit(Implicits.scala:1117) [error] at dotty.tools.dotc.typer.Implicits.typedImplicit$(Implicits.scala:818) [error] at dotty.tools.dotc.typer.Typer.typedImplicit(Typer.scala:116) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.tryImplicit(Implicits.scala:1242) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.rank$1(Implicits.scala:1341) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1511) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1539) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1547) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1572) [error] at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1060) [error] at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:818) [error] at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:116) [error] at dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:884) [error] at dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:818) [error] at dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:116) [error] at dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3737) [error] at dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3773) [error] at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3849) [error] at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4038) [error] at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4268) [error] at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] at dotty.tools.dotc.typer.Typer.readapt$1(Typer.scala:3598) [error] at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4255) [error] at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] at dotty.tools.dotc.typer.Implicits.typedImplicit(Implicits.scala:1117) [error] at dotty.tools.dotc.typer.Implicits.typedImplicit$(Implicits.scala:818) [error] at dotty.tools.dotc.typer.Typer.typedImplicit(Typer.scala:116) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.tryImplicit(Implicits.scala:1242) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.rank$1(Implicits.scala:1341) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1511) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1539) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1547) [error] at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1572) [error] at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1060) [error] at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:818) [error] at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:116) [error] at dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:884) [error] at dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:818) [error] at dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:116) [error] at dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3737) [error] at dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3773) [error] at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3849) [error] at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4038) [error] at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4268) [error] at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3587) [error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184) [error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188) [error] at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300) [error] at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1653) [error] at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1643) [error] at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1653) [error] at dotty.tools.dotc.typer.Namer$ClassCompleter.typedParentApplication$1(Namer.scala:1489) [error] at dotty.tools.dotc.typer.Namer$ClassCompleter.parentType$1(Namer.scala:1509) [error] at dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:1519) [error] at dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$29(Namer.scala:1592) [error] at scala.collection.immutable.List.map(List.scala:246) [error] at dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1592) [error] at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:814) [error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:174) [error] at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187) [error] at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189) [error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393) [error] at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2989) [error] at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3014) [error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111) [error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184) [error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188) [error] at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210) [error] at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256) [error] at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2812) [error] at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3081) [error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112) [error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184) [error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188) [error] at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300) [error] at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44) [error] at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54) [error] at scala.Function0.apply$mcV$sp(Function0.scala:42) [error] at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:440) [error] at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54) [error] at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88) [error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) [error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) [error] at scala.collection.immutable.List.foreach(List.scala:333) [error] at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88) [error] at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246) [error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) [error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) [error] at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321) [error] at dotty.tools.dotc.Run.runPhases$1(Run.scala:262) [error] at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270) [error] at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279) [error] at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67) [error] at dotty.tools.dotc.Run.compileUnits(Run.scala:279) [error] at dotty.tools.dotc.Run.compileSources(Run.scala:194) [error] at dotty.tools.dotc.Run.compile(Run.scala:179) [error] at dotty.tools.dotc.Driver.doCompile(Driver.scala:37) [error] at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) [error] at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) [error] at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) [error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192) [error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) [error] at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247) [error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182) [error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) [error] at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) [error] at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) [error] at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210) [error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528) [error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528) [error] at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177) [error] at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175) [error] at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461) [error] at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) [error] at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) [error] at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) [error] at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) [error] at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416) [error] at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503) [error] at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403) [error] at sbt.internal.inc.Incremental$.apply(Incremental.scala:169) [error] at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528) [error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482) [error] at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) [error] at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420) [error] at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) [error] at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2366) [error] at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2316) [error] at sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30) [error] at sbt.internal.io.Retry$.apply(Retry.scala:46) [error] at sbt.internal.io.Retry$.apply(Retry.scala:28) [error] at sbt.internal.io.Retry$.apply(Retry.scala:23) [error] at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30) [error] at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2314) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:49) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) [error] at sbt.std.Transform$$anon$4.work(Transform.scala:68) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) [error] at sbt.Execute.work(Execute.scala:291) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [error] at java.base/java.lang.Thread.run(Thread.java:833) [error] (Compile / compileIncremental) java.lang.Error: internal error: type of Mirror.*Of argument T is not fully defined, pos = compilerBug.scala:7 [error] Total time: 2 s, completed Oct 9, 2023, 4:36:08 PM ```
PawkyPenguin commented 1 year ago

Possibly related issues I found (crash in same method, Inferencing$.fullyDefinedType):

bishabosha commented 1 year ago

minimised with

import scala.deriving.Mirror

type TC[A]

object TC:
  inline given derived[A](using Mirror.Of[A]): TC[A] = ???

abstract class Payload[A <: Payload[A]: TC]()

case class Summary() extends Payload() // error: crash

if you explicitly pass the type Summary, rather than infer it then it works fine

case class Summary() extends Payload[Summary]() // ok