Skip to content

ClassCastException in TypeComparer.compareCaptured$1 #4376

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
sir-wabbit opened this issue Apr 25, 2018 · 6 comments
Closed

ClassCastException in TypeComparer.compareCaptured$1 #4376

sir-wabbit opened this issue Apr 25, 2018 · 6 comments

Comments

@sir-wabbit
Copy link

object App {
  type Id[A] >: A <: A

  val a: Array[_ >: Id[_ <: Int]] =
    (Array.ofDim[String](1) : Array[_ >: Id[Nothing]])
}
Exception in thread "main" java.lang.ClassCastException: dotty.tools.dotc.core.Types$LambdaParam cannot be cast to dotty.tools.dotc.core.Symbols$Symbol
	at dotty.tools.dotc.core.TypeComparer.compareCaptured$1(TypeComparer.scala:884)
	at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:896)
	at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:905)
	at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:685)
	at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:789)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:405)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:363)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:285)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$recur$2(TypeComparer.scala:853)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:129)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:124)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:127)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:110)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$less$colon$less$1(Types.scala:774)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:774)
	at dotty.tools.dotc.core.Types$TypeBounds.contains(Types.scala:3572)
	at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:892)
	at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:905)
	at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:685)
	at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:789)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:405)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:363)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:285)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$recur$2(TypeComparer.scala:853)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:129)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:124)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:127)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:110)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$less$colon$less$1(Types.scala:774)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:774)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:2330)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2398)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2529)
	at dotty.tools.dotc.typer.Typer.$anonfun$adapt$1(Typer.scala:2075)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2070)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1928)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedValDef$1(Typer.scala:1370)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1364)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1762)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1828)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1887)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1916)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1529)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1455)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1768)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1828)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1887)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1916)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedPackageDef$1(Typer.scala:1636)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1627)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1808)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1829)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1928)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$typeCheck$1(FrontEnd.scala:66)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:34)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:64)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$7(FrontEnd.scala:95)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$7$adapted(FrontEnd.scala:95)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:95)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:174)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:47)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:171)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:169)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:191)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:169)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:194)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:88)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:149)
	at dotty.tools.dotc.Run.compileSources(Run.scala:136)
	at dotty.tools.dotc.Run.compile(Run.scala:120)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:29)
	at dotty.tools.dotc.Driver.process(Driver.scala:127)
	at dotty.tools.dotc.Driver.process(Driver.scala:96)
	at dotty.tools.dotc.Driver.process(Driver.scala:108)
	at dotty.tools.dotc.Driver.main(Driver.scala:135)
	at dotty.tools.dotc.Main.main(Main.scala)
@smarter
Copy link
Member

smarter commented Apr 26, 2018

Id[_ <: Int]

This shouldn't compile (see #4382) and looking at the code I don't think the crash can be reproduced once we properly disallow wildcard arguments to hk types, so closing as duplicate of #4382

@Blaisorblade
Copy link
Contributor

I get the same exception with dotc -Ykind-polymorphism from https://gist.github.com/milessabin/9c0b79ff41aebd43bd0bbd0115b07f81/773063fdbbbcba59dad787302722211d2fab6a15 on a recent master, and it appears there are 0 uses of wildcard arguments to higher-kinded types (but a lot of uses of HK types).

-- Error: ../scala/functork.scala:67:17 ----------------------------------------
67 |    implicit def apply[G <: AnyKind, R <: AnyKind](implicit gen0: Generic[G, R]) =
   |                 ^
   |         result type of implicit definition needs to be given explicitly
exception occurred while typechecking ../scala/functork.scala
exception occurred while compiling ../scala/functork.scala
Exception in thread "main" java.lang.ClassCastException: dotty.tools.dotc.core.Types$LambdaParam cannot be cast to dotty.tools.dotc.core.Symbols$Symbol
	at dotty.tools.dotc.core.TypeComparer.compareCaptured$1(TypeComparer.scala:891)
	at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:903)
	at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:912)
	at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:692)
	at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:796)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:405)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:363)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:285)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$recur$2(TypeComparer.scala:860)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:129)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:124)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:127)
	at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:173)
	at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen$(ConstraintHandling.scala:170)
	at dotty.tools.dotc.core.TypeComparer.isSubTypeWhenFrozen(TypeComparer.scala:19)
	at dotty.tools.dotc.core.ConstraintHandling.isSubType(ConstraintHandling.scala:165)
	at dotty.tools.dotc.core.ConstraintHandling.isSubType$(ConstraintHandling.scala:163)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:19)
	at dotty.tools.dotc.core.TypeComparer.mergeIfSuper(TypeComparer.scala:1411)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$lub$2(TypeComparer.scala:1292)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.core.TypeComparer.lub(TypeComparer.scala:1285)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$bar$1(Types.scala:910)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.$bar(Types.scala:910)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$orType$2(TypeComparer.scala:1477)
	at dotty.tools.dotc.core.TypeComparer.liftIfHK(TypeComparer.scala:1492)
	at dotty.tools.dotc.core.TypeComparer.orType(TypeComparer.scala:1477)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$lub$2(TypeComparer.scala:1301)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.core.TypeComparer.lub(TypeComparer.scala:1285)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$lub$2(TypeComparer.scala:1300)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.core.TypeComparer.lub(TypeComparer.scala:1285)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$bar$1(Types.scala:910)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.$bar(Types.scala:910)
	at dotty.tools.dotc.core.ConstraintHandling.addOneBound(ConstraintHandling.scala:86)
	at dotty.tools.dotc.core.ConstraintHandling.addLowerBound(ConstraintHandling.scala:121)
	at dotty.tools.dotc.core.ConstraintHandling.addLowerBound$(ConstraintHandling.scala:116)
	at dotty.tools.dotc.core.TypeComparer.addLowerBound(TypeComparer.scala:19)
	at dotty.tools.dotc.core.ConstraintHandling.addConstraint(ConstraintHandling.scala:481)
	at dotty.tools.dotc.core.ConstraintHandling.addConstraint$(ConstraintHandling.scala:372)
	at dotty.tools.dotc.core.TypeComparer.addConstraint(TypeComparer.scala:19)
	at dotty.tools.dotc.core.TypeComparer.compareTypeParamRef$2(TypeComparer.scala:423)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:427)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:297)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:223)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$recur$2(TypeComparer.scala:860)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:129)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:225)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$recur$2(TypeComparer.scala:860)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:129)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:124)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:127)
	at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:905)
	at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:912)
	at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:692)
	at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:796)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:405)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:363)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:285)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$recur$2(TypeComparer.scala:860)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:129)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:124)
	at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:803)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:405)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:363)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:285)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$recur$2(TypeComparer.scala:860)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:129)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:124)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:127)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:110)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$less$colon$less$1(Types.scala:792)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:792)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:2326)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2394)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2526)
	at dotty.tools.dotc.typer.Typer.$anonfun$adapt$1(Typer.scala:2071)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2066)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.$anonfun$typedImplicit$3(Implicits.scala:886)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.$anonfun$typedImplicit$1(Implicits.scala:878)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.typedImplicit(Implicits.scala:878)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.tryImplicit(Implicits.scala:927)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.rank$1(Implicits.scala:1005)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicits(Implicits.scala:1095)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1103)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.$anonfun$bestImplicit$1(Implicits.scala:1108)
	at dotty.tools.dotc.typer.Implicits$SearchResult.recoverWith(Implicits.scala:269)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1104)
	at dotty.tools.dotc.typer.Implicits.$anonfun$inferImplicit$4(Implicits.scala:816)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Implicits.$anonfun$inferImplicit$1(Implicits.scala:814)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:810)
	at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:810)
	at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:83)
	at dotty.tools.dotc.typer.Implicits.$anonfun$inferView$1(Implicits.scala:531)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:518)
	at dotty.tools.dotc.typer.Implicits.inferView$(Implicits.scala:517)
	at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:2447)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:2349)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2394)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2526)
	at dotty.tools.dotc.typer.Typer.$anonfun$adapt$1(Typer.scala:2071)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2066)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:287)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:645)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:643)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:414)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:454)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:235)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:546)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:644)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:704)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$7(Applications.scala:729)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:1932)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$1(Applications.scala:730)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:674)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:774)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:672)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1774)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1825)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$typedArg$1(ProtoTypes.scala:286)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:251)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:286)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:645)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:643)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:414)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:454)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:235)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:546)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:644)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:704)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$7(Applications.scala:729)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:1932)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$1(Applications.scala:730)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:674)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:774)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:672)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1774)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1825)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1924)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$1(Applications.scala:676)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:674)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:774)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:672)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1774)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1825)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$typedArg$1(ProtoTypes.scala:286)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:251)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:286)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:645)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:643)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:414)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:454)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:235)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:546)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:644)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:704)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$7(Applications.scala:729)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:1932)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$1(Applications.scala:730)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:674)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:774)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:672)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1774)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1825)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1924)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedDefDef$1(Typer.scala:1423)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1402)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1762)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1824)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1883)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1912)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1526)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1450)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1765)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1824)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1883)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1912)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:665)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedBlock$1(Typer.scala:668)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:667)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1781)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1825)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedNew$1(Typer.scala:514)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedNew(Typer.scala:498)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1777)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1825)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1924)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedDefDef$1(Typer.scala:1423)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1402)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1762)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1824)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1883)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1912)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1526)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1450)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1765)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1824)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1883)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1912)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedPackageDef$1(Typer.scala:1631)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1624)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1804)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1825)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1856)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1864)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1924)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$typeCheck$1(FrontEnd.scala:66)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:34)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:64)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$7(FrontEnd.scala:95)
	at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$7$adapted(FrontEnd.scala:95)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:95)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:174)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:47)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:171)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:169)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:191)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:169)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:194)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:88)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:149)
	at dotty.tools.dotc.Run.compileSources(Run.scala:136)
	at dotty.tools.dotc.Run.compile(Run.scala:120)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:29)
	at dotty.tools.dotc.Driver.process(Driver.scala:127)
	at dotty.tools.dotc.Driver.process(Driver.scala:96)
	at dotty.tools.dotc.Driver.process(Driver.scala:108)
	at dotty.tools.dotc.Driver.main(Driver.scala:135)
	at dotty.tools.dotc.Main.main(Main.scala)
[error] java.lang.RuntimeException: Nonzero exit code returned from runner: 1
[error] 	at sbt.ForkRun.processExitCode$1(Run.scala:33)
[error] 	at sbt.ForkRun.run(Run.scala:42)
[error] 	at sbt.Defaults$.$anonfun$bgRunMainTask$6(Defaults.scala:1150)
[error] 	at sbt.Defaults$.$anonfun$bgRunMainTask$6$adapted(Defaults.scala:1145)
[error] 	at sbt.internal.BackgroundThreadPool.$anonfun$run$1(DefaultBackgroundJobService.scala:366)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] 	at scala.util.Try$.apply(Try.scala:209)
[error] 	at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:289)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (dotty-compiler / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 3 s, completed May 11, 2018 8:51:19 PM

@Blaisorblade Blaisorblade reopened this May 11, 2018
@smarter
Copy link
Member

smarter commented May 11, 2018

Can you try to minimize it?

@Blaisorblade Blaisorblade self-assigned this May 11, 2018
@Blaisorblade
Copy link
Contributor

Self-assigned for this, will do!

@b-studios
Copy link
Contributor

b-studios commented Jan 30, 2019

Not sure this is related, but I also get the same exception in the following example trying to encode rank-2 types with path dependent existentials:

object existentials {

  sealed trait Exists { type R }
  type Rank2[F[_]] = (e: Exists) |=> F[e.R]

  // implementation crashes the compiler
  def instantiate[F[_], A](f: Rank2[F]): F[A] = {
    implicit val e: Exists { type R = A } = null
    f
  }
  type ~>[F[_], G[_]] = Rank2[[X] => F[X] => G[X]]

  val nat: List ~> Option = {
    case Nil => None
    // also: x isn't refined to e.R
    case x :: _ => Some(x)
  }
}

Also, the type of x in the cons case is sadly not refined to e.R.

EDIT: It does look related to #5550, though.

@Blaisorblade Blaisorblade removed their assignment Jan 30, 2019
@Blaisorblade
Copy link
Contributor

Blaisorblade commented Jan 31, 2019

@b-studios "Same exception" is related enough for this bug for now... x not being refined is probably a separate bug (EDIT: filed #5828).
And using null for e is likely unsound because of e's type member (tho we can't detect that yet, and that doesn't justify a crash). new Exists { type R = A } still triggers the crash and would be better for use.

Unassigned myself as I'm unlikely to make progress here, should have done earlier.

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