Skip to content

Commit e476fe8

Browse files
authored
Merge pull request #7666 from dotty-staging/fix-projection-loop
Fix #7602: Avoid infinite loop with anonymous projection
2 parents b86373b + 59ea176 commit e476fe8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ object Types {
614614
}
615615
def goRec(tp: RecType) =
616616
if (tp.parent == null) NoDenotation
617+
else if (tp eq pre) go(tp.parent)
617618
else {
618619
//println(s"find member $pre . $name in $tp")
619620

tests/pos/i7602.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object Test {
2+
type X[T] = ({ type F[_]; type R = F[T]})#R
3+
4+
trait Monad[F[_]]
5+
type of[M[_[_]], T] = ({ type F[_]; type R = (given M[F]) => F[T]})#R
6+
def foo(a: of[Monad, String]) = ???
7+
}

0 commit comments

Comments
 (0)