Open
Description
Based on OpenCB failures of apache/pekko - build logs
The reproduction is not exact - this variant fails in all Scala 3 versions, the Apache Pekko can successfully be compiled using Scala 3.3 LTS, however I was not able to reach exactly the same behaviour (it was the 3rd attempt to reproduce it)
Compiler version
All Scala 3 versions
Minimized code
// defs.scala
object ProtocolTransport
import ProtocolTransport.*
@annotation.nowarn()
class ProtocolTransport()
// usage.scala
object Case1 {
def myProps(transport: ProtocolTransport): Unit = ???
}
Output
Warning: setting /Users/wmazur/projects/scala/sandbox as the project root directory for this run.
-- [E046] Cyclic Error: /Users/wmazur/projects/scala/sandbox/test1.scala:5:1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5 |@annotation.nowarn()
| ^
| Cyclic reference involving class ProtocolTransport
|
| The error occurred while trying to compute the signature of method myProps
| which required to compute the signature of class ProtocolTransport
| which required to compute the signature of object ProtocolTransport
| which required to compute the signature of class ProtocolTransport
|
| Stacktrace:
| dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:208)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
| dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
| dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
| dotty.tools.dotc.core.NamerOps$.addConstructorApplies(NamerOps.scala:155)
| dotty.tools.dotc.core.NamerOps$.addConstructorProxies(NamerOps.scala:221)
| dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1732)
| dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:859)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
| dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
| dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
| dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMembersNamed(SymDenotations.scala:2161)
| dotty.tools.dotc.core.SymDenotations$ClassDenotation.membersNamed(SymDenotations.scala:2131)
| dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2182)
| dotty.tools.dotc.core.Types$Type.go$1(Types.scala:783)
| dotty.tools.dotc.core.Types$Type.findMember(Types.scala:968)
| dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:756)
| dotty.tools.dotc.typer.Typer.selection$1(Typer.scala:325)
| dotty.tools.dotc.typer.Typer.wildImportRef$1(Typer.scala:386)
| dotty.tools.dotc.typer.Typer.loop$1(Typer.scala:538)
| dotty.tools.dotc.typer.Typer.findRefRecur$1(Typer.scala:556)
| dotty.tools.dotc.typer.Typer.findRef(Typer.scala:559)
| dotty.tools.dotc.typer.Typer.typedIdent(Typer.scala:620)
| dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3474)
| dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3584)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3662)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3666)
| dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3777)
| dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:992)
| dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:1034)
| dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3475)
| dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3584)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3662)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3666)
| dotty.tools.dotc.typer.Typer.typedType(Typer.scala:3780)
| dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1762)
| dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1755)
| dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1762)
| dotty.tools.dotc.typer.Namer.typedAheadAnnotationClass(Namer.scala:1771)
| dotty.tools.dotc.typer.Namer.typedAheadAnnotationClass(Namer.scala:1770)
| dotty.tools.dotc.typer.Namer.typedAheadAnnotationClass(Namer.scala:1768)
| dotty.tools.dotc.typer.Namer$Completer.addAnnotations$$anonfun$1(Namer.scala:883)
| scala.collection.immutable.List.mapConserve(List.scala:473)
| dotty.tools.dotc.typer.Namer$Completer.addAnnotations(Namer.scala:882)
| dotty.tools.dotc.typer.Namer$ClassCompleter.completeConstructor(Namer.scala:1522)
| dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1697)
| dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:859)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
| dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
| dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:66)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.is(SymDenotations.scala:112)
| dotty.tools.dotc.core.TypeUtils.isErasedClass(TypeUtils.scala:28)
| dotty.tools.dotc.typer.Typer.postProcessInfo(Typer.scala:2961)
| dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2837)
| dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3479)
| dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3584)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3662)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3666)
| dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3777)
| dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1765)
| dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1755)
| dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1765)
| dotty.tools.dotc.typer.Namer.completeParams$1$$anonfun$1(Namer.scala:1969)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
| scala.collection.immutable.List.foreach(List.scala:334)
| dotty.tools.dotc.typer.Namer.completeParams$1(Namer.scala:1967)
| dotty.tools.dotc.typer.Namer.completeTrailingParamss$$anonfun$2(Namer.scala:1976)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
| scala.collection.immutable.List.foreach(List.scala:334)
| dotty.tools.dotc.typer.Namer.completeTrailingParamss(Namer.scala:1976)
| dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1914)
| dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:830)
| dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:990)
| dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:859)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
| dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
| dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
| dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
| dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:3447)
| dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3472)
| dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3584)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3662)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3666)
| dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3688)
| dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3734)
| dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3164)
| dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3488)
| dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3492)
| dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3584)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3662)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3666)
| dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3688)
| dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3734)
| dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3297)
| dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3534)
| dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3585)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3662)
| dotty.tools.dotc.typer.Typer.typed(Typer.scala:3666)
| dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3777)
| dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
| dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:507)
| dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
| dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
| scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
| scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
| scala.collection.immutable.List.prependedAll(List.scala:152)
| scala.collection.immutable.List$.from(List.scala:685)
| scala.collection.immutable.List$.from(List.scala:682)
| scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
| dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
| dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
| scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
| scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
| dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
| dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:383)
| dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:395)
| dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
| dotty.tools.dotc.Run.compileUnits(Run.scala:395)
| dotty.tools.dotc.Run.compileSources(Run.scala:282)
| dotty.tools.dotc.Run.compile(Run.scala:267)
| dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
| dotty.tools.dotc.Driver.process(Driver.scala:201)
| dotty.tools.dotc.Driver.process(Driver.scala:169)
| dotty.tools.dotc.Driver.process(Driver.scala:181)
| dotty.tools.dotc.Driver.main(Driver.scala:211)
| dotty.tools.dotc.Main.main(Main.scala)
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| class ProtocolTransport is declared as part of a cycle which makes it impossible for the
| compiler to decide upon ProtocolTransport's type.
| To avoid this error, try giving ProtocolTransport an explicit type.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 error found
Expectation
Should compile