Skip to content

Crash on implicit method with multiple argument lists #3542

Closed
@nicolasstucki

Description

@nicolasstucki
object Foo {
  def f()()(implicit ctx: String): Int = ???
  def at[T](op: () => T): Unit = ()
  at(() => f())
}
assertion failure for (implicit ctx: String): Int <:< T, frozen = false
assertion failure for (implicit ctx: String): Int <:< T, frozen = false

Exception in thread "main" java.lang.AssertionError: assertion failed: AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),Function0),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),scala),Int))) MethodType(List(ctx), List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),Predef),String)), TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),scala),Int))
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.core.Types$OrType.<init>(Types.scala:2431)
	at dotty.tools.dotc.core.Types$CachedOrType.<init>(Types.scala:2463)
	at dotty.tools.dotc.core.Types$OrType$.apply(Types.scala:2468)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$orType$1(TypeComparer.scala:1418)
	at dotty.tools.dotc.core.TypeComparer.liftIfHK(TypeComparer.scala:1432)
	at dotty.tools.dotc.core.TypeComparer.orType(TypeComparer.scala:1418)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$lub$2(TypeComparer.scala:1244)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
	at dotty.tools.dotc.core.TypeComparer.lub(TypeComparer.scala:1228)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$bar$1(Types.scala:867)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.$bar(Types.scala:867)
	at dotty.tools.dotc.core.ConstraintHandling.narrowedBound(ConstraintHandling.scala:84)
	at dotty.tools.dotc.core.ConstraintHandling.narrowedBound$(ConstraintHandling.scala:78)
	at dotty.tools.dotc.core.TypeComparer.narrowedBound(TypeComparer.scala:19)
	at dotty.tools.dotc.core.ConstraintHandling.addOneBound(ConstraintHandling.scala:65)
	at dotty.tools.dotc.core.ConstraintHandling.addLowerBound(ConstraintHandling.scala:109)
	at dotty.tools.dotc.core.ConstraintHandling.addLowerBound$(ConstraintHandling.scala:104)
	at dotty.tools.dotc.core.TypeComparer.addLowerBound(TypeComparer.scala:19)
	at dotty.tools.dotc.core.ConstraintHandling.addConstraint(ConstraintHandling.scala:458)
	at dotty.tools.dotc.core.ConstraintHandling.addConstraint$(ConstraintHandling.scala:354)
	at dotty.tools.dotc.core.TypeComparer.addConstraint(TypeComparer.scala:19)
	at dotty.tools.dotc.core.TypeComparer.compareTypeParamRef$2(TypeComparer.scala:403)
	at dotty.tools.dotc.core.TypeComparer.thirdTry(TypeComparer.scala:407)
	at dotty.tools.dotc.core.TypeComparer.secondTry(TypeComparer.scala:353)
	at dotty.tools.dotc.core.TypeComparer.firstTry(TypeComparer.scala:215)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$isSubType$2(TypeComparer.scala:118)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:28)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:109)
	at dotty.tools.dotc.core.TypeComparer.firstTry(TypeComparer.scala:217)
	at dotty.tools.dotc.core.TypeComparer.$anonfun$isSubType$2(TypeComparer.scala:118)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:28)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:109)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:103)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$less$colon$less$1(Types.scala:749)
	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:749)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1104)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1164)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:736)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:78

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