Skip to content

Crash on implicit method with multiple argument lists #3542

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
nicolasstucki opened this issue Nov 23, 2017 · 0 comments
Closed

Crash on implicit method with multiple argument lists #3542

nicolasstucki opened this issue Nov 23, 2017 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

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
markarasev pushed a commit to markarasev/dotty that referenced this issue Nov 24, 2017
@odersky odersky closed this as completed in 868ad47 Jan 2, 2018
odersky added a commit that referenced this issue Jan 2, 2018
Fix #3542: Avoid comparisons between method types and typevars
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

1 participant