Skip to content

SOE during implicit search. #6058

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 Mar 9, 2019 · 2 comments
Closed

SOE during implicit search. #6058

sir-wabbit opened this issue Mar 9, 2019 · 2 comments

Comments

@sir-wabbit
Copy link

sir-wabbit commented Mar 9, 2019

implicit def i1[I2, I3](i4: I2)(implicit i5: I2 => I3): I3 = ( )

SOE-85929dc39a9360c6c7971b495331a4af3385f111


java.lang.StackOverflowError while compiling test.scala
Exception in thread "main" java.lang.StackOverflowError
	at dotty.tools.dotc.core.handleRecursive$.apply(TypeErrors.scala:99)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:154)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:162)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:126)
	at dotty.tools.dotc.core.Types$Type.$anonfun$$less$colon$less$1(Types.scala:839)
	at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:23)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:839)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:2645)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2718)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2927)
	at dotty.tools.dotc.typer.Typer.$anonfun$adapt$3(Typer.scala:2344)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.typer.Typer.$anonfun$adapt$1(Typer.scala:2343)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2343)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:334)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:753)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:751)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:519)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:562)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:340)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:654)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:752)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:814)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$9(Applications.scala:843)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2192)
	at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$1(Applications.scala:844)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:783)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:889)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:781)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:87)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2012)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2066)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2100)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2093)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2112)
	at dotty.tools.dotc.typer.Namer.$anonfun$typedAheadExpr$1(Namer.scala:1094)
	at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:1084)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1094)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1262)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1325)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:770)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:881)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:796)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:236)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:180)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:182)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:342)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1964)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1989)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2065)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2100)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2093)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2112)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2131)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2173)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:701)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedBlock$1(Typer.scala:704)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:703)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2019)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2066)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:2100)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2093)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2112)
	at dotty.tools.dotc.typer.Typer.typedFunctionValue(Typer.scala:977)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedFunction$1(Typer.scala:799)
@odersky
Copy link
Contributor

odersky commented Mar 18, 2019

@milessabin Should this have been caught in divergence checking?

@milessabin
Copy link
Contributor

@odersky yes it should. I'll take a look.

milessabin added a commit to milessabin/dotty that referenced this issue Mar 25, 2019
milessabin added a commit to milessabin/dotty that referenced this issue Apr 17, 2019
The fix for scala#6058 in scala#6163 caused a significant performance regression
in the inductive implicits benchmark because the use of =:= rather than
== in the divergence check was significantly slower. It is the right
test however, so we need a quicker check to rule out negative cases.

We're already computing the covering sets and sizes of the two types
being compared. tp1 =:= tp2 should entail (sz1 == sz2 && cs1 == cs2), so
the contrapositive (sz1 != sz2 || cs1 != cs2) should entail that !(tp1
=:= tp2). However the covering set and size computations were incorrect
(they missed types mentioned in bounds which should have been included,
and included symbols for unsolved type variables which should not).

This commit fixes the latter issue, which allows covering set and size
tests to be used to avoid expensive full type equality tests.
milessabin added a commit to milessabin/dotty that referenced this issue Apr 24, 2019
The fix for scala#6058 in scala#6163 caused a significant performance regression
in the inductive implicits benchmark because the use of =:= rather than
== in the divergence check was significantly slower. It is the right
test however, so we need a quicker check to rule out negative cases.

We're already computing the covering sets and sizes of the two types
being compared. tp1 =:= tp2 should entail (sz1 == sz2 && cs1 == cs2), so
the contrapositive (sz1 != sz2 || cs1 != cs2) should entail that !(tp1
=:= tp2). However the covering set and size computations were incorrect
(they missed types mentioned in bounds which should have been included,
and included symbols for unsolved type variables which should not).

This commit fixes the latter issue, which allows covering set and size
tests to be used to avoid expensive full type equality tests.
anatoliykmetyuk pushed a commit to dotty-staging/dotty that referenced this issue May 2, 2019
The fix for scala#6058 in scala#6163 caused a significant performance regression
in the inductive implicits benchmark because the use of =:= rather than
== in the divergence check was significantly slower. It is the right
test however, so we need a quicker check to rule out negative cases.

We're already computing the covering sets and sizes of the two types
being compared. tp1 =:= tp2 should entail (sz1 == sz2 && cs1 == cs2), so
the contrapositive (sz1 != sz2 || cs1 != cs2) should entail that !(tp1
=:= tp2). However the covering set and size computations were incorrect
(they missed types mentioned in bounds which should have been included,
and included symbols for unsolved type variables which should not).

This commit fixes the latter issue, which allows covering set and size
tests to be used to avoid expensive full type equality tests.
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