File tree 2 files changed +8
-3
lines changed
compiler/src/dotty/tools/dotc/typer 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,11 @@ object Checking {
232
232
// global symbols when doing the cyclicity check.
233
233
def isInteresting (prefix : Type ): Boolean = prefix.stripTypeVar match {
234
234
case NoPrefix => true
235
- case prefix : ThisType => sym.owner.isClass && prefix.cls.isContainedIn(sym.owner)
235
+ case prefix : ThisType =>
236
+ sym.owner.isClass && (
237
+ prefix.cls.isContainedIn(sym.owner) // sym reachable through outer references
238
+ || sym.owner.isContainedIn(prefix.cls) // sym reachable through member references
239
+ )
236
240
case prefix : NamedType =>
237
241
(! sym.is(Private ) && prefix.derivesFrom(sym.owner)) ||
238
242
(! prefix.symbol.isStaticOwner && isInteresting(prefix.prefix))
@@ -242,6 +246,7 @@ object Checking {
242
246
case _ : RefinedOrRecType | _ : AppliedType => true
243
247
case _ => false
244
248
}
249
+
245
250
if (isInteresting(pre)) {
246
251
val pre1 = this (pre, false , false )
247
252
if (locked.contains(tp) || tp.symbol.infoOrCompleter.isInstanceOf [NoCompleter ])
Original file line number Diff line number Diff line change @@ -98,12 +98,12 @@ object Test6 {
98
98
99
99
object Test7 {
100
100
class Fix [F [_]] {
101
- class Foo { type R >: F [T ] <: F [T ] }
101
+ class Foo { type R >: F [T ] <: F [T ] } // error: cyclic
102
102
type T = F [Foo # R ]
103
103
}
104
104
105
105
object App {
106
- type Nat = Fix [Option ]# T // error: too deep
106
+ type Nat = Fix [Option ]# T
107
107
}
108
108
}
109
109
/*
You can’t perform that action at this time.
0 commit comments