Skip to content

Commit

Permalink
Decrement depth in subtype check withTypeVars
Browse files Browse the repository at this point in the history
  • Loading branch information
joroKr21 committed Oct 1, 2018
1 parent 7c8b36f commit d58630a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/internal/tpe/TypeComparers.scala
Expand Up @@ -528,7 +528,7 @@ trait TypeComparers {
(rt2.parents forall (isSubType(tp1, _, depth))) &&
(rt2.decls forall (specializesSym(tp1, _, depth)))
case et2: ExistentialType =>
et2.withTypeVars(isSubType(tp1, _, depth), depth) || fourthTry
et2.withTypeVars(isSubType(tp1, _, depth), depth.decr) || fourthTry
case mt2: MethodType =>
tp1 match {
case mt1 @ MethodType(params1, res1) =>
Expand Down
18 changes: 18 additions & 0 deletions test/files/pos/t7612.scala
@@ -0,0 +1,18 @@
trait Fili[A]
trait Kili[M] {
def fili: Fili[M]
}

trait A extends Kili[A] {
def fili: Fili[A]
}

trait Ori[M] extends Kili[M] {
val ori: Fili[M]
def fili: ori.type
}
trait B extends Ori[B]

object Test {
def foo(a: A, b: B) = if (true) a else b // LUB triggers StackOverflowError
}

0 comments on commit d58630a

Please sign in to comment.