Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

compiler error with -Yinduction-heuristics #158

Open
wedens opened this issue Jun 11, 2017 · 2 comments
Open

compiler error with -Yinduction-heuristics #158

wedens opened this issue Jun 11, 2017 · 2 comments

Comments

@wedens
Copy link

wedens commented Jun 11, 2017

TLS version: 2.12.2-bin-typelevel-4

java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.TimSort.mergeHi(TimSort.java:899)
        at java.util.TimSort.mergeAt(TimSort.java:516)
        at java.util.TimSort.mergeForceCollapse(TimSort.java:457)
        at java.util.TimSort.sort(TimSort.java:254)
        at java.util.Arrays.sort(Arrays.java:1438)
        at scala.collection.SeqLike.sorted(SeqLike.scala:646)
        at scala.collection.SeqLike.sorted$(SeqLike.scala:634)
        at scala.collection.AbstractSeq.sorted(Seq.scala:41)
        at scala.collection.SeqLike.sortWith(SeqLike.scala:599)
        at scala.collection.SeqLike.sortWith$(SeqLike.scala:599)
        at scala.collection.AbstractSeq.sortWith(Seq.scala:41)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.tryInduction(Implicits.scala:1189)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1774)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:92)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:81)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicit(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor(Implicits.scala:39)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor$(Implicits.scala:38)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicitFor(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$applyImplicitArgs$2(Typers.scala:174)
        at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:166)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:889)
        at scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:485)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1244)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1241)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:675)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:612)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:481)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$AbstractImplicitComputation.rankImplicits(Implicits.scala:976)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$AbstractImplicitComputation.findBest(Implicits.scala:1004)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1061)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1777)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:92)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:81)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicit(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor(Implicits.scala:39)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor$(Implicits.scala:38)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicitFor(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$applyImplicitArgs$2(Typers.scala:174)
        at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:166)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:889)
        at scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:485)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1244)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1241)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:675)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:612)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:481)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$AbstractImplicitComputation.rankImplicits(Implicits.scala:976)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$AbstractImplicitComputation.findBest(Implicits.scala:1004)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1061)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1777)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:92)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:81)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicit(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor(Implicits.scala:39)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor$(Implicits.scala:38)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicitFor(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$applyImplicitArgs$2(Typers.scala:174)
        at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:166)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:889)
        at scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:485)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1244)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1241)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:675)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:612)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:481)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$AbstractImplicitComputation.rankImplicits(Implicits.scala:976)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$AbstractImplicitComputation.findBest(Implicits.scala:1004)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1061)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1777)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:92)
        at scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:81)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicit(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor(Implicits.scala:39)
        at scala.tools.nsc.typechecker.Implicits.inferImplicitFor$(Implicits.scala:38)
        at org.scalameta.paradise.typechecker.HijackAnalyzer$$anon$2.inferImplicitFor(HijackAnalyzer.scala:31)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$applyImplicitArgs$2(Typers.scala:174)
        at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:166)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:889)
        at scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:485)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1244)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5645)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5703)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction(Typers.scala:3061)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$97(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typerWithLocalContext$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5556)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5588)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3280)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:485)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArgToPoly$1(Typers.scala:3670)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$doTypedApply$34(Typers.scala:3678)
        at scala.tools.nsc.typechecker.Typers$Typer.handlePolymorphicCall$1(Typers.scala:3678)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3689)
        at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4768)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4796)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5578)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5703)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction(Typers.scala:3061)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$97(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typerWithLocalContext$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5556)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5588)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3280)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:485)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArgToPoly$1(Typers.scala:3670)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$doTypedApply$34(Typers.scala:3678)
        at scala.tools.nsc.typechecker.Typers$Typer.handlePolymorphicCall$1(Typers.scala:3678)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3689)
        at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4768)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4796)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5578)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5712)
        at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5718)
        at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:5027)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5579)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5703)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction(Typers.scala:3061)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$97(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typerWithLocalContext$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5556)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5588)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3280)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:485)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArgToPoly$1(Typers.scala:3670)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$doTypedApply$34(Typers.scala:3678)
        at scala.tools.nsc.typechecker.Typers$Typer.handlePolymorphicCall$1(Typers.scala:3678)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3689)
        at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4768)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4796)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5578)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5703)
        at scala.tools.nsc.typechecker.Typers$Typer.typedCase(Typers.scala:2558)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedCases$1(Typers.scala:2577)
        at scala.tools.nsc.typechecker.Typers$Typer.typedCases(Typers.scala:2576)
        at scala.tools.nsc.typechecker.Typers$Typer.typedMatch(Typers.scala:2588)
        at scala.tools.nsc.typechecker.Typers$Typer.applyOrElseMethodDef$1(Typers.scala:2714)
        at scala.tools.nsc.typechecker.Typers$Typer.synthesizePartialFunction(Typers.scala:2826)
        at scala.tools.nsc.typechecker.Typers$Typer.typedVirtualizedMatch$1(Typers.scala:4465)
        at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5557)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5588)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3280)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:485)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgWithFormal$1(PatternTypers.scala:113)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.$anonfun$typedArgsForFormals$1(PatternTypers.scala:116)
        at scala.runtime.Tuple2Zipped$.$anonfun$map$1(Tuple2Zipped.scala:47)
        at scala.collection.immutable.List.foreach(List.scala:389)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals(PatternTypers.scala:116)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals$(PatternTypers.scala:110)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArgsForFormals(Typers.scala:112)
        at scala.tools.nsc.typechecker.Typers$Typer.handleMonomorphicCall$1(Typers.scala:3625)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$doTypedApply$31(Typers.scala:3651)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3651)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$25(Typers.scala:4682)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$silent$2(Typers.scala:719)
        at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:719)
        at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4682)
        at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4766)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4796)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5578)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5703)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction(Typers.scala:3061)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$97(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typerWithLocalContext$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction$1(Typers.scala:494)
        at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5556)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5588)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3280)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:485)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgWithFormal$1(PatternTypers.scala:113)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.$anonfun$typedArgsForFormals$1(PatternTypers.scala:116)
        at scala.runtime.Tuple2Zipped$.$anonfun$map$1(Tuple2Zipped.scala:47)
        at scala.collection.immutable.List.foreach(List.scala:389)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals(PatternTypers.scala:116)
        at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals$(PatternTypers.scala:110)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArgsForFormals(Typers.scala:112)
        at scala.tools.nsc.typechecker.Typers$Typer.handleMonomorphicCall$1(Typers.scala:3625)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$doTypedApply$31(Typers.scala:3651)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3651)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$25(Typers.scala:4682)
        at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:705)
        at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4682)
        at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4766)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4796)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5578)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5595)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5842)
        at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2326)
        at scala.tools.nsc.typechecker.ParadiseAnalyzer$ParadiseTyper.typedDefDef(Analyzer.scala:17)
        at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5543)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5594)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5692)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3120)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$9(Typers.scala:3264)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3264)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2021)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1892)
        at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5545)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5594)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5692)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3120)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$9(Typers.scala:3264)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3264)
        at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5234)
        at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5547)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5594)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5631)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5661)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5605)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5609)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5688)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
        at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:425)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:418)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1(Analyzer.scala:94)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1$adapted(Analyzer.scala:93)
        at scala.collection.Iterator.foreach(Iterator.scala:929)
        at scala.collection.Iterator.foreach$(Iterator.scala:929)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1417)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1461)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1446)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1441)
        at scala.tools.nsc.Global$Run.compile(Global.scala:1535)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
        at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:107)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:53)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:50)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
        at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:74)
        at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:49)
        at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:64)
        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
        at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:72)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:71)
        at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:99)
        at sbt.inc.Incremental$.compile(Incremental.scala:71)
        at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
        at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
        at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
        at sbt.Compiler$.compile(Compiler.scala:155)
        at sbt.Compiler$.compile(Compiler.scala:141)
        at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:886)
        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:877)
        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:875)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)

Looks like this is the line with the error.

@Astrac
Copy link

Astrac commented Jul 14, 2017

Also affects 2.11.11 of typelevel-4; this is how I can recreate it using circe: circe/circe#710

It also happens in other situations, not necessarily using the deriveEncoder function:

import io.circe.Encoder

case class Bar[C]()

trait Foo[T]

object Bar {

  implicit def e0[T](implicit ev: Foo[Encoder[T]]): Encoder[T] = Encoder[Unit].contramap(_ => ())

  implicit def e2[C]: Encoder[Bar[C]] = Encoder[Unit].contramap(_ => ())

  implicit val e1: Encoder[Bar[String]] = Encoder[Unit].contramap(_ => ())
}

object Test {
  implicitly[Encoder[Bar[String]]]
}

Removing any of e1, e2 or e3 will fix the issue but moving any combination of them in a LowPriority trait won't. I tried replacing Encoder with a dummy typeclass but it didn't crash so I suspect that the issue must be caused by some more complex clash involving also the implicits already defined in the Encoder companion object.

@travisbrown
Copy link

There's not really anything that weird about the instances that the Encoder companion object provides—there are a couple of levels for prioritization, and there are some generic instances for collection types, but circe-core is 100% macro-free and I can't think of anything that could contribute to this.

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

No branches or pull requests

3 participants