Skip to content

Assertion failure in ImplicitSearch #803

Closed
@DarkDimius

Description

@DarkDimius
class Foo{
  val default = this
  def foo(a: Int)(b: Foo = default): b.type = b
  val s: default.type = foo(1)
}
xception in thread "main" java.lang.AssertionError: assertion failed: found: this.foo(1): (b: Foo)Foo(b), expected: Foo(Foo.this.default)
    at scala.Predef$.assert(Predef.scala:165)
    at dotty.tools.dotc.typer.Implicits$ImplicitSearch.<init>(Implicits.scala:454)
    at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1$$anonfun$apply$17.apply(Implicits.scala:429)
    at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1$$anonfun$apply$17.apply(Implicits.scala:425)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
    at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1.apply(Implicits.scala:425)
    at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1.apply(Implicits.scala:420)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Implicits$class.inferImplicit(Implicits.scala:420)
    at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:58)
    at dotty.tools.dotc.typer.Implicits$$anonfun$inferView$1.apply(Implicits.scala:403)
    at dotty.tools.dotc.typer.Implicits$$anonfun$inferView$1.apply(Implicits.scala:397)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Implicits$class.inferView(Implicits.scala:396)
    at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:58)
    at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:1401)
    at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:1361)
    at dotty.tools.dotc.typer.Typer.adaptInterpolated(Typer.scala:1440)
    at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1$$anonfun$apply$15.apply(Typer.scala:1185)
    at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1$$anonfun$apply$15.apply(Typer.scala:1182)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
    at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1.apply(Typer.scala:1182)
    at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1.apply(Typer.scala:1182)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:1181)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1090)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1088)
    at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1127)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedValDef$1.apply(Typer.scala:883)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedValDef$1.apply(Typer.scala:877)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:877)
    at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1025)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1078)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1090)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1088)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1112)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1123)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:924)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:907)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:907)
    at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1031)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1078)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1090)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1088)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1112)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1123)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:971)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:962)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:962)
    at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1068)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1080)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1090)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1088)
    at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1127)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$typeCheck$1.apply$mcV$sp(FrontEnd.scala:42)
    at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:19)
    at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:40)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:53)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:53)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:53)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:59)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:56)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:56)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
    at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:69)
    at dotty.tools.dotc.Run.compileUnits(Run.scala:52)
    at dotty.tools.dotc.Run.compileSources(Run.scala:49)
    at dotty.tools.dotc.Run.compile(Run.scala:33)
    at dotty.tools.dotc.Driver.doCompile(Driver.scala:21)
    at dotty.tools.dotc.Driver.process(Driver.scala:44)
    at dotty.tools.dotc.Driver.main(Driver.scala:48)
    at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions