diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 7f1554c3dbec..25289c455127 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -614,6 +614,7 @@ object Types { } def goRec(tp: RecType) = if (tp.parent == null) NoDenotation + else if (tp eq pre) go(tp.parent) else { //println(s"find member $pre . $name in $tp") diff --git a/tests/pos/i7602.scala b/tests/pos/i7602.scala new file mode 100644 index 000000000000..0a380efc9d79 --- /dev/null +++ b/tests/pos/i7602.scala @@ -0,0 +1,7 @@ +object Test { + type X[T] = ({ type F[_]; type R = F[T]})#R + + trait Monad[F[_]] + type of[M[_[_]], T] = ({ type F[_]; type R = (given M[F]) => F[T]})#R + def foo(a: of[Monad, String]) = ??? +}