Skip to content

Assertion fail during implicit search: constraint before search neq constraint after search #3348

Closed
@allanrenucci

Description

@allanrenucci

The following code snippet crashes the compiler:

class Test {
  import Test.test
  "Hello".toto
}

object Test {
  def test = {
    implicitly[collection.generic.CanBuildFrom[List[_], Int, List[_]]]
  }
}
Stacktrace
exception occurred while typechecking tests/allan/Test.scala

exception occurred while compiling tests/allan/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:204)
at dotty.tools.dotc.typer.Implicits.$anonfun$inferImplicit$4(Implicits.scala:740)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Implicits.$anonfun$inferImplicit$1(Implicits.scala:712)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:707)
at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:707)
at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:69)
at dotty.tools.dotc.typer.Implicits.$anonfun$inferView$1(Implicits.scala:537)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:524)
at dotty.tools.dotc.typer.Implicits.inferView$(Implicits.scala:523)
at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:69)
at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:2228)
at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:2136)
at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2175)
at dotty.tools.dotc.typer.Typer.adaptInterpolated(Typer.scala:2298)
at dotty.tools.dotc.typer.Typer.$anonfun$adapt$3(Typer.scala:1862)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.$anonfun$adapt$1(Typer.scala:1858)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:1858)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1696)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1692)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1753)
at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:397)
at dotty.tools.dotc.typer.Typer.$anonfun$typedSelect$1(Typer.scala:431)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:395)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1613)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1678)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1696)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1692)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1729)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1741)
at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1409)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1339)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1623)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1678)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1696)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1692)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1718)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1741)
at dotty.tools.dotc.typer.Typer.$anonfun$typedPackageDef$1(Typer.scala:1522)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1509)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1662)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1679)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1696)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1692)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1753)
at dotty.tools.dotc.typer.FrontEnd.$anonfun$typeCheck$1(FrontEnd.scala:64)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:32)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:62)
at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$7(FrontEnd.scala:93)
at dotty.tools.dotc.typer.FrontEnd.$anonfun$runOn$7$adapted(FrontEnd.scala:93)
at scala.collection.immutable.List.foreach(List.scala:389)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:93)
at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:124)
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:122)
at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:120)
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.$anonfun$compileUnits$1(Run.scala:120)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:86)
at dotty.tools.dotc.Run.compileUnits(Run.scala:108)
at dotty.tools.dotc.Run.compileSources(Run.scala:95)
at dotty.tools.dotc.Run.compile(Run.scala:79)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:26)
at dotty.tools.dotc.Driver.process(Driver.scala:124)
at dotty.tools.dotc.Driver.process(Driver.scala:93)
at dotty.tools.dotc.Driver.process(Driver.scala:105)
at dotty.tools.dotc.Driver.main(Driver.scala:132)
at dotty.tools.dotc.Main.main(Main.scala)


Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions