Skip to content

Commit 052433a

Browse files
committed
Fix cyclic computation of topType.
neg/cycles.scala
1 parent 9920e23 commit 052433a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ object Types {
182182
* - XYX.Any if XYZ extends scala.Phantom and this type is upper bounded XYZ.Any
183183
* - scala.Any otherwise
184184
*/
185-
final def topType(implicit ctx: Context): TypeRef = this match {
185+
final def topType(implicit ctx: Context): TypeRef = widen match {
186186
case tp: ClassInfo if isPhantomClass(tp.classSymbol) => tp.prefix.select(tpnme.Any).asInstanceOf[TypeRef]
187-
case tp: TypeProxy => tp.superType.topType
187+
case tp: TypeProxy if tp.superType ne this => tp.superType.topType
188188
case tp: AndOrType => tp.tp1.topType
189189
case _ => defn.AnyType
190190
}

0 commit comments

Comments
 (0)