Skip to content

Commit 1659aab

Browse files
Fix a similar bug in TypeTestsCasts
I manually inspected all calls to loBound/hiBound and found another place in the compiler where they are use during a traversal. The added test case fails on master with a SO, just like scala#8905.
1 parent e847e5a commit 1659aab

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ object TypeTestsCasts {
8181
/** Approximate type parameters depending on variance */
8282
def stripTypeParam(tp: Type)(implicit ctx: Context) = new ApproximatingTypeMap {
8383
def apply(tp: Type): Type = tp match {
84+
case _: MatchType =>
85+
tp // break cycles
8486
case tp: TypeRef if isBounds(tp.underlying) =>
8587
val lo = apply(tp.info.loBound)
8688
val hi = apply(tp.info.hiBound)

tests/pos/8905-2.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Test[T1 <: Tuple, T2 <: Tuple] {
2+
def test6[Y <: Int, X <: Function1[Tuple.Concat[T1, T2], Unit]](x: X) = x.isInstanceOf[Function1[Int, Any]]
3+
}

0 commit comments

Comments
 (0)