@@ -447,7 +447,18 @@ object Types {
447
447
if (rinfo.isAlias) rinfo
448
448
else if (pdenot.info.isAlias) pdenot.info
449
449
else if (ctx.pendingMemberSearches.contains(name)) safeAnd(pdenot.info, rinfo)
450
- else pdenot.info & rinfo
450
+ else
451
+ try pdenot.info & rinfo
452
+ catch {
453
+ case ex : CyclicReference =>
454
+ // happens for tests/pos/sets.scala. findMember is called from baseTypeRef.
455
+ // The & causes a subtype check which calls baseTypeRef again with the same
456
+ // superclass. In the observed case, the superclass was Any, and
457
+ // the special shortcut for Any in derivesFrom was as yet absent. To reproduce,
458
+ // remove the special treatment of Any in derivesFrom and compile
459
+ // sets.scala.
460
+ safeAnd(pdenot.info, rinfo)
461
+ }
451
462
pdenot.asSingleDenotation.derivedSingleDenotation(pdenot.symbol, jointInfo)
452
463
} else
453
464
pdenot & (new JointRefDenotation (NoSymbol , rinfo, Period .allInRun(ctx.runId)), pre)
@@ -1562,6 +1573,15 @@ object Types {
1562
1573
case _ =>
1563
1574
false
1564
1575
}
1576
+
1577
+ /* A version of toString which also prints aliases. Can be used for debugging
1578
+ override def toString =
1579
+ if (isTerm) s"TermRef($prefix, $name)"
1580
+ else s"TypeRef($prefix, $name)${
1581
+ if (lastDenotation != null && lastDenotation.infoOrCompleter.isAlias)
1582
+ s"@@@ ${lastDenotation.infoOrCompleter.asInstanceOf[TypeAlias].hi}"
1583
+ else ""}"
1584
+ */
1565
1585
}
1566
1586
1567
1587
abstract case class TermRef (override val prefix : Type , name : TermName ) extends NamedType with SingletonType {
0 commit comments