Skip to content

Cyclic reference involving class, when using java packages #9492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Swoorup opened this issue Aug 4, 2020 · 5 comments
Closed

Cyclic reference involving class, when using java packages #9492

Swoorup opened this issue Aug 4, 2020 · 5 comments

Comments

@Swoorup
Copy link

Swoorup commented Aug 4, 2020

When inter-oping with java libraries I get a compiler bug. I have attached a minimal repo as an attachment. The code is as straightforward as borrowed from here: https://github.com/knowm/XChange/blob/b6ed6d1d2a/xchange-stream-btcmarkets/src/test/java/info/bitrich/xchangestream/btcmarkets/BTCMarketsManualExample.java#L16-L41

cyclic-reference-bug.zip

A more simple scastie repro: https://scastie.scala-lang.org/wmyqtC1KRQOiUG64Kicb0A

This doesn't happen with scala though.

dottyVersion = "0.26.0-RC1"

Output with -Ydebug-error

[error] Cyclic reference involving class LimitOrder 
[warn] one warning found 
[error] Cyclic reference involving class LimitOrder
java.lang.Exception: Stack trace
        at java.base/java.lang.Thread.dumpStack(Thread.java:1379)
        at dotty.tools.dotc.report$.error(report.scala:72)
        at dotty.tools.dotc.report$.error(report.scala:75)
        at dotty.tools.dotc.typer.ErrorReporting$.errorType(ErrorReporting.scala:34)
  | => cat dotty.tools.dotc.typer.ErrorReporting$.errorTree(ErrorReporting.scala:26)
        at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2885)
        at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
        at dotty.tools.dotc.typer.Typer.typedNamedArg(Typer.scala:800)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2429)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2484)
        at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$2(ProtoTypes.scala:337)
        at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:293)
        at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:338)
        at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:818)
        at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:818)
        at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:540)
        at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:611)
        at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:363)
        at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:713)
        at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:817)
        at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1026)
        at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:233)
        at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:91)
        at dotty.tools.dotc.ast.Trees$Instance.applyOverloaded(Trees.scala:1585)
        at dotty.tools.dotc.ast.Trees$Instance.resolveConstructor(Trees.scala:1591)
        at dotty.tools.dotc.core.Annotations$Annotation$.deferredResolve$$anonfun$1(Annotations.scala:170)
        at dotty.tools.dotc.core.Annotations$.dotty$tools$dotc$core$Annotations$$anon$2$$_$$lessinit$greater$$anonfun$2(Annotations.scala:155)
        at dotty.tools.dotc.core.Annotations$LazyAnnotation.tree(Annotations.scala:79)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotArg$$anonfun$2(ClassfileParser.scala:531)
        at scala.Option.map(Option.scala:242)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotArg(ClassfileParser.scala:531)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotArg$$anonfun$3(ClassfileParser.scala:520)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotArg$$anonfun$adapted$1(ClassfileParser.scala:523)
        at scala.collection.immutable.Range.foreach(Range.scala:190)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotArg(ClassfileParser.scala:523)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotation$$anonfun$3(ClassfileParser.scala:554)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotation$$anonfun$adapted$1(ClassfileParser.scala:558)
        at scala.collection.immutable.Range.foreach(Range.scala:190)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotation(ClassfileParser.scala:558)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotations$2$$anonfun$1(ClassfileParser.scala:649)
        at dotty.runtime.function.JFunction1$mcVI$sp.apply(JFunction1$mcVI$sp.java:12)
        at scala.collection.immutable.Range.foreach(Range.scala:190)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAnnotations$1(ClassfileParser.scala:653)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAttribute$3(ClassfileParser.scala:607)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAttributes$$anonfun$1(ClassfileParser.scala:658)
        at dotty.runtime.function.JFunction1$mcVI$sp.apply(JFunction1$mcVI$sp.java:12)
        at scala.collection.immutable.Range.foreach(Range.scala:190)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAttributes(ClassfileParser.scala:658)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseClass(ClassfileParser.scala:190)
        at dotty.tools.dotc.core.classfile.ClassfileParser.run(ClassfileParser.scala:90)
        at dotty.tools.dotc.core.ClassfileLoader.load(SymbolLoaders.scala:402)
        at dotty.tools.dotc.core.ClassfileLoader.doComplete(SymbolLoaders.scala:397)
        at dotty.tools.dotc.core.SymbolLoader.complete(SymbolLoaders.scala:342)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:166)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeOnce(SymDenotations.scala:344)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.unforcedDecls(SymDenotations.scala:368)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.typeParamsFromDecls(SymDenotations.scala:1637)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.typeParams(SymDenotations.scala:1650)
        at dotty.tools.dotc.core.classfile.ClassfileParser$$anon$3.apply(ClassfileParser.scala:38)
        at dotty.tools.dotc.core.classfile.ClassfileParser$$anon$3.apply(ClassfileParser.scala:37)
        at scala.collection.immutable.List.mapConserve(List.scala:472)
        at dotty.tools.dotc.core.classfile.ClassfileParser$$anon$3.apply(ClassfileParser.scala:47)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseAttributes(ClassfileParser.scala:660)
        at dotty.tools.dotc.core.classfile.ClassfileParser.parseClass(ClassfileParser.scala:190)
        at dotty.tools.dotc.core.classfile.ClassfileParser.run(ClassfileParser.scala:90)
        at dotty.tools.dotc.core.ClassfileLoader.load(SymbolLoaders.scala:402)
        at dotty.tools.dotc.core.ClassfileLoader.doComplete(SymbolLoaders.scala:397)
        at dotty.tools.dotc.core.SymbolLoader.complete(SymbolLoaders.scala:342)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:166)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeOnce(SymDenotations.scala:344)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.isAbsent(SymDenotations.scala:536)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.isAccessibleFrom(SymDenotations.scala:834)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.accessibleFrom(Denotations.scala:614)
        at dotty.tools.dotc.typer.Typer.selection$3(Typer.scala:202)
        at dotty.tools.dotc.typer.Typer.recur$1(Typer.scala:233)
        at dotty.tools.dotc.typer.Typer.namedImportRef$1(Typer.scala:240)
        at dotty.tools.dotc.typer.Typer.loop$2(Typer.scala:376)
        at dotty.tools.dotc.typer.Typer.findRefRecur$1(Typer.scala:398)
        at dotty.tools.dotc.typer.Typer.findRef(Typer.scala:401)
        at dotty.tools.dotc.typer.Typer.typedIdent(Typer.scala:471)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2392)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2483)
        at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
        at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1220)
        at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1212)
        at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1220)
        at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1423)
        at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1475)
        at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:684)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:801)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:712)
        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:352)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2365)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2390)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2483)
        at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2579)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2627)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2081)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2411)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2415)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2483)
        at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2579)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2627)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2207)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2455)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2484)
        at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2671)
        at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:78)
        at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
        at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
        at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
        at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:119)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:119)
        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:181)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
        at dotty.tools.dotc.Run.runPhases$5(Run.scala:191)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:199)
        at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:206)
        at dotty.tools.dotc.Run.compileSources(Run.scala:143)
        at dotty.tools.dotc.Run.compile(Run.scala:125)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
        at dotty.tools.dotc.Driver.process(Driver.scala:195)
        at dotty.tools.dotc.Main.process(Main.scala)
        at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
        at xsbt.CompilerInterface.run(CompilerInterface.java:41)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
        at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
        at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
        at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
        at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
        at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
        at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
        at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
        at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
        at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
        at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
        at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
        at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
        at sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
        at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
        at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
        at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
        at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
        at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
        at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1765)
        at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1738)
        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:67)
        at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
        at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
        at sbt.Execute.work(Execute.scala:290)
        at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
        at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
        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:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:832)
[error] one error found
[
[error] one error found 
[error] (Compile / compileIncremental) Compilation failed 
[error] Total time: 2 s, completed 4 Aug 2020, 9:29:59 pm

Expectation

Compilation succeeds.

@Jasper-M
Copy link
Contributor

Jasper-M commented Aug 4, 2020

This is the problematic class: https://github.com/knowm/XChange/blob/develop/xchange-core/src/main/java/org/knowm/xchange/dto/trade/LimitOrder.java#L22

@Swoorup
Copy link
Author

Swoorup commented Aug 5, 2020

This might be of interest: scala/bug#3809
Subsequent commit to patch the issue in Scala previous versions: scala/scala@ae6da15

@Swoorup
Copy link
Author

Swoorup commented Aug 10, 2020

More isolated bug repro thanks to @smarter

 // DerivedClass.java
package CyclicRefAnnArray;
import java.lang.*;

@interface BaseClassAnn {
    Type[] value();
    @interface Type {
        Class<?> value();
    }
}

@BaseClassAnn({
    @BaseClassAnn.Type(value=DerivedClass.class)
})
abstract class BaseClass {}

class DerivedClass extends BaseClass {}
// main.scala
package CyclicRefAnnArray;

object Main {
  def oops: DerivedClass = ???

  def main(args: Array[String]): Unit = {
    println("ok")
  }
}

Compile and run with: javac -d output *.java; dotc -classpath output/ main.scala

smarter added a commit to dotty-staging/dotty that referenced this issue Aug 11, 2020
Java allows annotations inside arrays inside annotations, when parsing
the outer annotation, we need to produce an untyped tree for the array
and therefore the nested annotations. Previously this was done using
`Annotation#tree` which actually produces a typed tree, this works since
typed trees can be used as untyped tree but it requires forcing the
content of the nested annotation which can lead to cycles.

Instead, we now use a dedicated subclass of Annotation with an extra
`untpdTree` method we use for the purpose of generating a tree for the
nested annotation without forcing anything.
odersky added a commit that referenced this issue Aug 12, 2020
@bplommer
Copy link
Contributor

I'm still getting this with 3.0.0-M2, while trying to port vulcan to Dotty.

The Java library I'm using is "org.apache.avro" % "avro" % "1.10.0". The specific file is at https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java

A minimal reproduction is

def oops = org.apache.avro.SchemaBuilder.builder().fixed("foo")

scastie reproduction (3.0.0-M1)

Output with -Ydebug-error:

sbt:vx1ka5jhtoax0guv87vfkq> compile
[info] Compiling 1 Scala source to /Users/benplom/Downloads/Vx1Ka5jhToaX0guV87vFkQ/target/scala-3.0.0-M2/classes ...
exception caught when loading class FixedBuilder: Cyclic reference involving class FixedBuilder
java.lang.Exception: Stack trace
	at java.base/java.lang.Thread.dumpStack(Thread.java:1379)
	at dotty.tools.dotc.report$.error(report.scala:72)
	at dotty.tools.dotc.report$.error(report.scala:75)
  | => vat dotty.tools.dotc.typer.ErrorReporting$.errorType(ErrorReporting.scala:38)
	at dotty.tools.dotc.typer.ErrorReporting$.errorTree(ErrorReporting.scala:30)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2535)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2720)
	at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:549)
	at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:574)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2441)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2531)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2720)
	at dotty.tools.dotc.typer.Applications.typedFunPart$$anonfun$1(Applications.scala:852)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2728)
	at dotty.tools.dotc.typer.Applications.typedFunPart(Applications.scala:861)
	at dotty.tools.dotc.typer.Applications.typedFunPart$(Applications.scala:236)
	at dotty.tools.dotc.typer.Typer.typedFunPart(Typer.scala:92)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:873)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1026)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:236)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:92)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2471)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2532)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1232)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1219)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1232)
	at dotty.tools.dotc.typer.Namer.rhsType$1$$anonfun$1(Namer.scala:1367)
	at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:216)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1367)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1378)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1379)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1390)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1398)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1483)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:684)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:801)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:712)
	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.typer.Typer.retrieveSym(Typer.scala:2413)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2438)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2531)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2627)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2676)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2131)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2459)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2463)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2531)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2627)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2676)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2503)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2532)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2720)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:43)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:85)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:120)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:120)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:185)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:195)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:203)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:210)
	at dotty.tools.dotc.Run.compileSources(Run.scala:147)
	at dotty.tools.dotc.Run.compile(Run.scala:129)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:193)
	at dotty.tools.dotc.Main.process(Main.scala)
	at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
	at xsbt.CompilerInterface.run(CompilerInterface.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
	at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
	at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
	at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
	at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
	at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
	at sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
	at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1765)
	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1738)
	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:67)
	at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
	at sbt.Execute.work(Execute.scala:290)
	at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
	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:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)
[error] -- [E046] Cyclic Error: /Users/benplom/Downloads/Vx1Ka5jhToaX0guV87vFkQ/src/main/scala/main.scala:1:48
[error] 1 |def oops = org.apache.avro.SchemaBuilder.builder().fixed("foo")
[error]   |                                                ^
[error]   |                             Cyclic reference involving class FixedBuilder
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed 30 Nov 2020, 18:05:02

@smarter
Copy link
Member

smarter commented Nov 30, 2020

@bplommer There's many different things that can cause cycles, please open a new issue for the problem you're encountering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants