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

Cyclic stuff and stale symbol in macro #14182

Open Adam-Vandervorst opened 2 years ago

Adam-Vandervorst commented 2 years ago

Compiler version

3.1.2-RC1-bin-20211222-c94b333-NIGHTLY

Minimized code

// poly_inline.scala
class TBase

inline def foreach[T <: Tuple, A](inline xs: T)(inline f: A => Unit) = ${ foreachImpl('{xs}, '{f}) }

@main def example =
  foreach(new TBase *: new TBase *: EmptyTuple){(ins: TBase) => ???}
  // I promise the non-minimized version makes perfect sense

// macro_file.scala
import scala.quoted._

def foreachImpl[T <: Tuple : Type, A : Type](xs: Expr[T], f: Expr[A => Unit])(using Quotes): Expr[Unit] =
  xs match
    case '{ EmptyTuple } => '{ () }
    case '{ type t1 <: A; $t: Tuple1[`t1`] } => '{ $f($t._1) }
    case '{ type t1 <: A; type t2 <: A; $t: Tuple2[`t1`, `t2`] } => '{ $f($t._1); $f($t._2) }

Output

class TBase#5492 is invalid at Period(1..1, run = 3) because decls of module class poly_inline#5476 are List(class TBase), do not contain class TBase
defined =  Period(1..11, run = 2)
module class TBase$#5497 is invalid at Period(1..1, run = 3) because decls of module class poly_inline#5476 are List(), do not contain module class TBase$
defined =  Period(1..11, run = 2)
caught exception when searching for suggestions
caught exception when searching for suggestions
[error] -- [E007] Type Mismatch Error: /poly_inline.scala:45:47 
[error] 45 |  foreach(new TBase *: new TBase *: EmptyTuple)((ins: TBase) => ???)
[error]    |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |  Found:    T1
[error]    |  Required: poly_inline.this.TBase
[error]    | This location contains code that was inlined from macro_file.scala:24
[error]    | This location contains code that was inlined from macro_file.scala:24
caught exception when searching for suggestions
caught exception when searching for suggestions
dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; module class TBase$#5497 in module class poly_inline, defined in Period(1..11, run = 2), is referred to in run Period(1..1, run = 3)
Click the arrow to see the full stack trace. dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; module class TBase$#5497 in module class poly_inline, defined in Period(1..11, run = 2), is referred to in run Period(1..1, run = 3) at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:955) at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:754) at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:803) at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:877) at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:122) at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:116) at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109) at dotty.tools.dotc.core.SymDenotations$ModuleCompleter.complete(SymDenotations.scala:2689) at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:168) at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188) at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190) at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370) at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:65) at dotty.tools.dotc.core.SymDenotations$SymDenotation.is(SymDenotations.scala:117) at dotty.tools.dotc.typer.ImportSuggestions.lookInside$1(ImportSuggestions.scala:68) at dotty.tools.dotc.typer.ImportSuggestions.$anonfun$1(ImportSuggestions.scala:92) at dotty.tools.dotc.core.Scopes$Scope.filter(Scopes.scala:103) at dotty.tools.dotc.typer.ImportSuggestions.rootsStrictlyIn$1(ImportSuggestions.scala:92) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:121) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.suggestionRoots(ImportSuggestions.scala:135) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestions(ImportSuggestions.scala:236) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum(ImportSuggestions.scala:323) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum$(ImportSuggestions.scala:23) at dotty.tools.dotc.typer.Typer.importSuggestionAddendum(Typer.scala:119) at dotty.tools.dotc.reporting.TypeMismatch.msg(messages.scala:278) at dotty.tools.dotc.reporting.Message.message(Message.scala:87) at dotty.tools.dotc.reporting.Message.isNonSensical(Message.scala:99) at dotty.tools.dotc.reporting.HideNonSensicalMessages.isHidden(HideNonSensicalMessages.scala:16) at dotty.tools.dotc.reporting.HideNonSensicalMessages.isHidden$(HideNonSensicalMessages.scala:10) at dotty.tools.dotc.reporting.AbstractReporter.isHidden(AbstractReporter.scala:8) at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:153) at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:177) at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:195) at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:198) at dotty.tools.dotc.reporting.Reporter.flush$$anonfun$1(Reporter.scala:243) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) at scala.collection.immutable.List.foreach(List.scala:333) at dotty.tools.dotc.reporting.Reporter.flush(Reporter.scala:243) at dotty.tools.dotc.core.TyperState.commit(TyperState.scala:144) at dotty.tools.dotc.typer.Applications.fail$1(Applications.scala:980) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4$$anonfun$1(Applications.scala:986) at scala.Option.getOrElse(Option.scala:201) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4(Applications.scala:987) at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3077) at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:988) at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1026) at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1595) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2983) at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3006) at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067) at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2810) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1843) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2824) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2927) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1600) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2807) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1052) at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:160) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1466) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1477) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94) at dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72) at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21) at dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44) at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308) at scala.collection.immutable.List.map(List.scala:246) at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309) at dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48) at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259) 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:270) at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68) at dotty.tools.dotc.Run.compileUnits(Run.scala:287) at dotty.tools.dotc.Run.compileUnits(Run.scala:226) at dotty.tools.dotc.Driver.finish(Driver.scala:60) at dotty.tools.dotc.Driver.doCompile(Driver.scala:40) at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:175) at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173) at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459) at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414) at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501) at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401) at sbt.internal.inc.Incremental$.apply(Incremental.scala:167) at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482) at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420) at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2357) at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314) at sbt.internal.io.Retry$.apply(Retry.scala:46) at sbt.internal.io.Retry$.apply(Retry.scala:28) at sbt.internal.io.Retry$.apply(Retry.scala:23) at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31) at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310) at scala.Function1.$anonfun$compose$1(Function1.scala:49) at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) at sbt.std.Transform$$anon$4.work(Transform.scala:68) at sbt.Execute.$anonfun$submit$2(Execute.scala:282) at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) at sbt.Execute.work(Execute.scala:291) at sbt.Execute.$anonfun$submit$1(Execute.scala:282) at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) at sbt.CompletionService$$anon$2.call(CompletionService.scala:64) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) dotty.tools.dotc.core.CyclicReference: at dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:155) at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:166) at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188) at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190) at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370) at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:65) at dotty.tools.dotc.core.SymDenotations$SymDenotation.is(SymDenotations.scala:117) at dotty.tools.dotc.typer.ImportSuggestions.lookInside$1(ImportSuggestions.scala:68) at dotty.tools.dotc.typer.ImportSuggestions.$anonfun$1(ImportSuggestions.scala:92) at dotty.tools.dotc.core.Scopes$Scope.filter(Scopes.scala:103) at dotty.tools.dotc.typer.ImportSuggestions.rootsStrictlyIn$1(ImportSuggestions.scala:92) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:121) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.suggestionRoots(ImportSuggestions.scala:135) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestions(ImportSuggestions.scala:236) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum(ImportSuggestions.scala:323) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum$(ImportSuggestions.scala:23) at dotty.tools.dotc.typer.Typer.importSuggestionAddendum(Typer.scala:119) at dotty.tools.dotc.reporting.TypeMismatch.msg(messages.scala:278) at dotty.tools.xsbt.DelegatingReporter.doReport(DelegatingReporter.java:43) at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:154) at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:177) at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:195) at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:198) at dotty.tools.dotc.reporting.Reporter.flush$$anonfun$1(Reporter.scala:243) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) at scala.collection.immutable.List.foreach(List.scala:333) at dotty.tools.dotc.reporting.Reporter.flush(Reporter.scala:243) at dotty.tools.dotc.core.TyperState.commit(TyperState.scala:144) at dotty.tools.dotc.typer.Applications.fail$1(Applications.scala:980) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4$$anonfun$1(Applications.scala:986) at scala.Option.getOrElse(Option.scala:201) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4(Applications.scala:987) at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3077) at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:988) at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1026) at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1595) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2983) at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3006) at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067) at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2810) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1843) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2824) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2927) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1600) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2807) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1052) at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:160) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1466) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1477) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94) at dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72) at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21) at dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44) at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308) at scala.collection.immutable.List.map(List.scala:246) at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309) at dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48) at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259) 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:270) at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68) at dotty.tools.dotc.Run.compileUnits(Run.scala:287) at dotty.tools.dotc.Run.compileUnits(Run.scala:226) at dotty.tools.dotc.Driver.finish(Driver.scala:60) at dotty.tools.dotc.Driver.doCompile(Driver.scala:40) at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:175) at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173) at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459) at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414) at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501) at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401) at sbt.internal.inc.Incremental$.apply(Incremental.scala:167) at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482) at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420) at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2357) at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314) at sbt.internal.io.Retry$.apply(Retry.scala:46) at sbt.internal.io.Retry$.apply(Retry.scala:28) at sbt.internal.io.Retry$.apply(Retry.scala:23) at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31) at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310) at scala.Function1.$anonfun$compose$1(Function1.scala:49) at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) at sbt.std.Transform$$anon$4.work(Transform.scala:68) at sbt.Execute.$anonfun$submit$2(Execute.scala:282) at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) at sbt.Execute.work(Execute.scala:291) at sbt.Execute.$anonfun$submit$1(Execute.scala:282) at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) at sbt.CompletionService$$anon$2.call(CompletionService.scala:64) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) dotty.tools.dotc.core.CyclicReference: at dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:155) at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:166) at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188) at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190) at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370) at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:65) at dotty.tools.dotc.core.SymDenotations$SymDenotation.is(SymDenotations.scala:117) at dotty.tools.dotc.typer.ImportSuggestions.lookInside$1(ImportSuggestions.scala:68) at dotty.tools.dotc.typer.ImportSuggestions.$anonfun$1(ImportSuggestions.scala:92) at dotty.tools.dotc.core.Scopes$Scope.filter(Scopes.scala:103) at dotty.tools.dotc.typer.ImportSuggestions.rootsStrictlyIn$1(ImportSuggestions.scala:92) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:121) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.suggestionRoots(ImportSuggestions.scala:135) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestions(ImportSuggestions.scala:236) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum(ImportSuggestions.scala:323) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum$(ImportSuggestions.scala:23) at dotty.tools.dotc.typer.Typer.importSuggestionAddendum(Typer.scala:119) at dotty.tools.dotc.reporting.TypeMismatch.msg(messages.scala:278) at dotty.tools.dotc.reporting.Message.message(Message.scala:87) at dotty.tools.dotc.reporting.Message.isNonSensical(Message.scala:99) at dotty.tools.dotc.reporting.HideNonSensicalMessages.isHidden(HideNonSensicalMessages.scala:16) at dotty.tools.dotc.reporting.HideNonSensicalMessages.isHidden$(HideNonSensicalMessages.scala:10) at dotty.tools.dotc.reporting.AbstractReporter.isHidden(AbstractReporter.scala:8) at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:153) at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:177) at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:195) at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:198) at dotty.tools.dotc.reporting.Reporter.flush$$anonfun$1(Reporter.scala:243) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) at scala.collection.immutable.List.foreach(List.scala:333) at dotty.tools.dotc.reporting.Reporter.flush(Reporter.scala:243) at dotty.tools.dotc.core.TyperState.commit(TyperState.scala:144) at dotty.tools.dotc.typer.Applications.fail$1(Applications.scala:980) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4$$anonfun$1(Applications.scala:986) at scala.Option.getOrElse(Option.scala:201) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4(Applications.scala:987) at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3077) at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:988) at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1026) at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1595) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050) at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1073) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2810) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1843) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2824) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2927) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1600) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2807) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1052) at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:160) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1466) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1477) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94) at dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72) at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21) at dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44) at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308) at scala.collection.immutable.List.map(List.scala:246) at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309) at dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48) at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259) 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:270) at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68) at dotty.tools.dotc.Run.compileUnits(Run.scala:287) at dotty.tools.dotc.Run.compileUnits(Run.scala:226) at dotty.tools.dotc.Driver.finish(Driver.scala:60) at dotty.tools.dotc.Driver.doCompile(Driver.scala:40) at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:175) at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173) at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459) at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414) at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501) at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401) at sbt.internal.inc.Incremental$.apply(Incremental.scala:167) at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482) at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420) at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2357) at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314) at sbt.internal.io.Retry$.apply(Retry.scala:46) at sbt.internal.io.Retry$.apply(Retry.scala:28) at sbt.internal.io.Retry$.apply(Retry.scala:23) at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31) at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310) at scala.Function1.$anonfun$compose$1(Function1.scala:49) at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) at sbt.std.Transform$$anon$4.work(Transform.scala:68) at sbt.Execute.$anonfun$submit$2(Execute.scala:282) at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) at sbt.Execute.work(Execute.scala:291) at sbt.Execute.$anonfun$submit$1(Execute.scala:282) at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) at sbt.CompletionService$$anon$2.call(CompletionService.scala:64) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) dotty.tools.dotc.core.CyclicReference: at dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:155) at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:166) at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188) at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190) at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370) at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:65) at dotty.tools.dotc.core.SymDenotations$SymDenotation.is(SymDenotations.scala:117) at dotty.tools.dotc.typer.ImportSuggestions.lookInside$1(ImportSuggestions.scala:68) at dotty.tools.dotc.typer.ImportSuggestions.$anonfun$1(ImportSuggestions.scala:92) at dotty.tools.dotc.core.Scopes$Scope.filter(Scopes.scala:103) at dotty.tools.dotc.typer.ImportSuggestions.rootsStrictlyIn$1(ImportSuggestions.scala:92) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:121) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.recur$1(ImportSuggestions.scala:132) at dotty.tools.dotc.typer.ImportSuggestions.suggestionRoots(ImportSuggestions.scala:135) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestions(ImportSuggestions.scala:236) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum(ImportSuggestions.scala:323) at dotty.tools.dotc.typer.ImportSuggestions.importSuggestionAddendum$(ImportSuggestions.scala:23) at dotty.tools.dotc.typer.Typer.importSuggestionAddendum(Typer.scala:119) at dotty.tools.dotc.reporting.TypeMismatch.msg(messages.scala:278) at dotty.tools.xsbt.DelegatingReporter.doReport(DelegatingReporter.java:43) at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:154) at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:177) at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:195) at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:198) at dotty.tools.dotc.reporting.Reporter.flush$$anonfun$1(Reporter.scala:243) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) at scala.collection.immutable.List.foreach(List.scala:333) at dotty.tools.dotc.reporting.Reporter.flush(Reporter.scala:243) at dotty.tools.dotc.core.TyperState.commit(TyperState.scala:144) at dotty.tools.dotc.typer.Applications.fail$1(Applications.scala:980) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4$$anonfun$1(Applications.scala:986) at scala.Option.getOrElse(Option.scala:201) at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4(Applications.scala:987) at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3077) at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:988) at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1026) at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1595) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050) at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1073) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2810) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1843) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2824) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2927) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1600) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62) at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2807) at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865) at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121) at dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1682) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930) at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934) at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1052) at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:160) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1466) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80) at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53) at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60) at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1477) at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120) at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94) at dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72) at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21) at dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44) at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308) at scala.collection.immutable.List.map(List.scala:246) at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309) at dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48) at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259) 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:270) at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68) at dotty.tools.dotc.Run.compileUnits(Run.scala:287) at dotty.tools.dotc.Run.compileUnits(Run.scala:226) at dotty.tools.dotc.Driver.finish(Driver.scala:60) at dotty.tools.dotc.Driver.doCompile(Driver.scala:40) at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182) at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:175) at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:173) at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459) at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414) at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:501) at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401) at sbt.internal.inc.Incremental$.apply(Incremental.scala:167) at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528) at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482) at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420) at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2357) at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2314) at sbt.internal.io.Retry$.apply(Retry.scala:46) at sbt.internal.io.Retry$.apply(Retry.scala:28) at sbt.internal.io.Retry$.apply(Retry.scala:23) at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31) at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2310) at scala.Function1.$anonfun$compose$1(Function1.scala:49) at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) at sbt.std.Transform$$anon$4.work(Transform.scala:68) at sbt.Execute.$anonfun$submit$2(Execute.scala:282) at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) at sbt.Execute.work(Execute.scala:291) at sbt.Execute.$anonfun$submit$1(Execute.scala:282) at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265) at sbt.CompletionService$$anon$2.call(CompletionService.scala:64) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

Expectation

Still on the quest to unroll a for-loop. I understand that the types are not provided at the right levels for this to make sense (this should conceptually work with polymorphic functions, but that approach faces other issues including https://github.com/lampepfl/dotty/issues/14180). The error saying Found T1; Required: poly_inline.this.TBase doesn't make any sense to me. What is T1? Even when the code is edited to never mention anything with T this still reads T1. So either this somehow mistakenly re-uses caches from when this code looked like https://github.com/lampepfl/dotty/issues/13918#issuecomment-965255875 or auto-generating it. In the former case, that would be incorrect since T1[_] <:< TBase[_] holds there. In the latter case, it is not very helpful in debugging. The elephant in the room is the cyclic stuff.

nicolasstucki commented 2 years ago
Workaround
def foreachImpl[T <: Tuple : Type, A : Type](xs: Expr[T], f: Expr[A => Unit])(using Quotes): Expr[Unit] =
  xs match
    case '{ EmptyTuple } => '{ () }
    case '{ type t1 <: A; $t: Tuple1[`t1`] } => 
-     '{ $f($t._1) }
+     '{ $f($t._1 : t1) }
    case '{ type t1 <: A; type t2 <: A; $t: Tuple2[`t1`, `t2`] } => 
-     '{ $f($t._1); $f($t._2) }
+     '{ $f($t._1 : t1); $f($t._2 : t2) }
nicolasstucki commented 2 years ago
Workaround
def foreachImpl[T <: Tuple : Type, A : Type](xs: Expr[T], f: Expr[A => Unit])(using Quotes): Expr[Unit] =
  xs match
    case '{ EmptyTuple } => '{ () }
    case '{ type t1 <: A; $t: Tuple1[`t1`] } => 
-     '{ $f($t._1) }
+     '{ $f($t(0)) }
    case '{ type t1 <: A; type t2 <: A; $t: Tuple2[`t1`, `t2`] } => 
-     '{ $f($t._1); $f($t._2) }
+     '{ $f($t(0)); $f($t(1)) }
nicolasstucki commented 2 years ago

Minimized

import scala.quoted._
def fooImpl(xs: Expr[(Int, Int)])(using Quotes): Expr[Unit] =
  '{ val a: Int = $xs._1; }
inline def foo(inline xs: (Int, Int)): Unit = ${ fooImpl('xs) }
def fail = foo(1 *: 2 *: EmptyTuple)
def ok = foo((1, 2))
3 |def fail = foo(1 *: 2 *: EmptyTuple)
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^
  |           Found:    T1
  |           Required: Int
  | This location contains code that was inlined from Foo.scala:3
  | This location contains code that was inlined from Foo.scala:3
nicolasstucki commented 2 years ago

Related issue

inline def foo(inline xs: (Int, Int)): Unit = { val a: Int = xs._1; }
def fail = foo(1 *: 2 *: EmptyTuple)
def ok = foo((1, 2))
2 |def fail = foo(1 *: 2 *: EmptyTuple)
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^
  |_1 cannot be accessed as a member of (xs$proxy1 : (Int, Int)) from module class Bar$package$.
  | This location contains code that was inlined from Bar.scala:1