scala / scala3

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

Compiler crashes when using summonAll for many elements #13927

Open oscar-broman opened 2 years ago

oscar-broman commented 2 years ago

Compiler version

Every version, latest version tested is 3.1.2-RC1-bin-20211102-82172ed-NIGHTLY

Minimized code

import scala.deriving.Mirror
import scala.compiletime.*

class ApiSpec[T]

object ApiSpec {
  inline given derived[T](using m: Mirror.Of[T]): ApiSpec[T] = {
    inline m match
      case s: Mirror.SumOf[T] =>
        summonAll[Tuple.Map[s.MirroredElemTypes, ApiSpec]]
        ???
      case p: Mirror.ProductOf[T] =>
        summonAll[Tuple.Map[p.MirroredElemTypes, ApiSpec]]
        ???
  }
}

sealed trait A
case class B() extends A
case class C() extends A
case class D() extends A
case class E() extends A
case class F() extends A
case class G() extends A
case class H() extends A
case class I() extends A
case class J() extends A
case class K() extends A
case class L() extends A
case class M() extends A
case class N() extends A
case class O() extends A
case class B2() extends A
case class C2() extends A
case class D2() extends A
case class E2() extends A
case class F2() extends A
case class G2() extends A
case class H2() extends A
case class I2() extends A
case class J2() extends A
case class K2() extends A
case class L2() extends A
case class M2() extends A
case class N2() extends A
case class O2() extends A

object Test {
  case class Interface(a: A)
  summon[ApiSpec[Interface]]
}

Output

[error] java.lang.AssertionError: assertion failed: <notype> class dotty.tools.dotc.ast.Trees$TypeTree -1
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.typer.ReTyper.assertTyped(ReTyper.scala:29)
[error] dotty.tools.dotc.typer.ReTyper.promote(ReTyper.scala:33)
[error] dotty.tools.dotc.typer.ReTyper.typedTypeTree(ReTyper.scala:69)
[error] dotty.tools.dotc.typer.ReTyper.typedTypeTree(ReTyper.scala:68)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.typedType(Typer.scala:3029)
[error] dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1427)
[error] dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1420)
[error] dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1427)
[error] dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1557)
[error] dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:756)
[error] dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:888)
[error] dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:780)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:168)
[error] dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
[error] dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
[error] dotty.tools.dotc.typer.Namer$ClassCompleter.completeConstructor(Namer.scala:1244)
[error] dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1360)
[error] dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:780)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:168)
[error] dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
[error] dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370)
[error] dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2721)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2746)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2841)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2933)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2983)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1044)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1048)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2787)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.typedNew(Typer.scala:795)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2783)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Synthesizer.anonymousMirror(Synthesizer.scala:190)
[error] dotty.tools.dotc.typer.Synthesizer.sumMirror(Synthesizer.scala:337)
[error] dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$6$$anonfun$1$$anonfun$1$$anonfun$1(Synthesizer.scala:361)
[error] dotty.tools.dotc.typer.Synthesizer.makeMirror(Synthesizer.scala:347)
[error] dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$6$$anonfun$1(Synthesizer.scala:361)
[error] dotty.tools.dotc.typer.Synthesizer.$init$$$anonfun$7$$anonfun$1(Synthesizer.scala:374)
[error] dotty.tools.dotc.typer.Synthesizer.recur$1(Synthesizer.scala:514)
[error] dotty.tools.dotc.typer.Synthesizer.tryAll(Synthesizer.scala:519)
[error] dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:851)
[error] dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:771)
[error] dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:107)
[error] dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3373)
[error] dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3409)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3489)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3687)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3909)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3251)
[error] dotty.tools.dotc.typer.Typer.readapt$1(Typer.scala:3262)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3896)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3251)
[error] dotty.tools.dotc.typer.Implicits.typedImplicit(Implicits.scala:1042)
[error] dotty.tools.dotc.typer.Implicits.typedImplicit$(Implicits.scala:771)
[error] dotty.tools.dotc.typer.Typer.typedImplicit(Typer.scala:107)
[error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.tryImplicit(Implicits.scala:1142)
[error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.rank$1(Implicits.scala:1243)
[error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1411)
[error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1418)
[error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1426)
[error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1451)
[error] dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:991)
[error] dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:771)
[error] dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:107)
[error] dotty.tools.dotc.typer.Implicits.ignoredInstanceNormalImport$1(Implicits.scala:880)
[error] dotty.tools.dotc.typer.Implicits.$anonfun$2(Implicits.scala:894)
[error] dotty.tools.dotc.typer.ImplicitSearchError.hiddenImplicitsAddendum(ErrorReporting.scala:419)
[error] dotty.tools.dotc.typer.ImplicitSearchError.missingArgMsg(ErrorReporting.scala:267)
[error] dotty.tools.dotc.typer.Implicits.missingArgMsg(Implicits.scala:895)
[error] dotty.tools.dotc.typer.Implicits.missingArgMsg$(Implicits.scala:771)
[error] dotty.tools.dotc.typer.Typer.missingArgMsg(Typer.scala:107)
[error] dotty.tools.dotc.typer.Inliner.searchImplicit$1(Inliner.scala:852)
[error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:856)
[error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:157)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.inlineIfNeeded(Inliner.scala:1675)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedTypeApply(Inliner.scala:1606)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2798)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3027)
[error] dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2164)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedValDef(Inliner.scala:1585)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2753)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2841)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2933)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2983)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1044)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1048)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2787)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3027)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedMatchFinish(Inliner.scala:1650)
[error] dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1548)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedMatch(Inliner.scala:1615)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2793)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3027)
[error] dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2164)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedValDef(Inliner.scala:1585)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2753)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2841)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2933)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2983)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1044)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1048)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2787)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2784)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2904)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1049)
[error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:157)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.inlineIfNeeded(Inliner.scala:1675)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedTypeApply(Inliner.scala:1606)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2798)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2960)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2983)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1044)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1048)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2787)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3027)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedMatchFinish(Inliner.scala:1650)
[error] dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1548)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedMatch(Inliner.scala:1615)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2793)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3027)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1050)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2787)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2784)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2842)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1679)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2907)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2904)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2911)
[error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1049)
[error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:157)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1430)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1430)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1473)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1484)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[error] dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72)
[error] dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)
[error] dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308)
[error] scala.collection.immutable.List.map(List.scala:250)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309)
[error] dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:261)
[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:1323)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:272)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:289)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:222)
[error] dotty.tools.dotc.Run.compile(Run.scala:206)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
[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:175)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459)
[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:414)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:167)
[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:2357)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314)
[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:31)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310)
[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)

Note

Compiles just fine with -Xmax-inlines:33.

Expectation

No crash. Possibly an error showing max inlines reached.

Surely a better summonAll should be possible to make internally, that doesn't have this limitation.

odersky commented 2 years ago

Surely a better summonAll should be possible to make internally, that doesn't have this limitation.

That's what we do not want to do, however. summonAll is just a normal macro, and should stay that way.

ckipp01 commented 1 year ago

Note, there is no longer an assertion error that happens here using 3.3.1-RC1-bin-20230514-b0ccf40-NIGHTLY you get the following:

[error] No given instance of type ApiSpec[A] was found.
[error] I found:
[error]
[error]     ApiSpec.derived[A](
[error]       {
[error]         final class $anon() extends Object(), Serializable {
[error]           type MirroredMonoType = A
[error]         }
[error]         (new $anon():Object & Serializable)
[error]       }.$asInstanceOf[
[error]
[error]           scala.deriving.Mirror.Sum{
[error]             type MirroredMonoType² = A; type MirroredType = A;
[error]               type MirroredLabel = ("A" : String);
[error]               type MirroredElemTypes = (B, C, D, E, F, G, H, I, J, K, L, M, N, O,
[error]                 B2, C2, D2, E2, F2, G2, H2, I2, J2, K2, L2, M2, N2, O2);
[error]               type MirroredElemLabels = (("B" : String), ("C" : String),
[error]                 ("D" : String), ("E" : String), ("F" : String), ("G" : String),
[error]                 ("H" : String), ("I" : String), ("J" : String), ("K" : String),
[error]                 ("L" : String), ("M" : String), ("N" : String), ("O" : String),
[error]                 ("B2" : String), ("C2" : String), ("D2" : String), ("E2" : String),
[error]                 ("F2" : String), ("G2" : String), ("H2" : String), ("I2" : String),
[error]                 ("J2" : String), ("K2" : String), ("L2" : String), ("M2" : String),
[error]                 ("N2" : String), ("O2" : String))
[error]           }
[error]
[error]       ]
[error]     )
[error]
[error] But given instance derived in object ApiSpec does not match type ApiSpec[A]
[error]
[error] where:    MirroredMonoType  is a type in an anonymous class locally defined in object Test which is an alias of A
[error]           MirroredMonoType² is a type in trait Mirror with bounds
[error] .
[error]
[error] Note: given instance derived in object ApiSpec was not considered because it was not imported with `import given`.
[error]   summon[ApiSpec[Interface]]
[error]                             ^
Error compiling project (Scala 3.3.1-RC1-bin-20230514-b0ccf40-NIGHTLY, JVM)
Compilation failed