@@ -68,11 +68,6 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
68
68
private var myInstance : TypeComparer = this
69
69
def currentInstance : TypeComparer = myInstance
70
70
71
- /** All capturing types in the original `tp1` enclosing the currently
72
- * compared type.
73
- */
74
- private var enclosingCapturing1 : List [AnnotatedType ] = Nil
75
-
76
71
/** Is a subtype check in progress? In that case we may not
77
72
* permanently instantiate type variables, because the corresponding
78
73
* constraint might still be retracted and the instantiation should
@@ -553,11 +548,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
553
548
if tp1.isBoxedCapturing && ! parent1.isBoxedCapturing
554
549
then tp2.unboxed
555
550
else tp2
556
- try
557
- enclosingCapturing1 = tp1 :: enclosingCapturing1
558
- recur(parent1, tp2a)
559
- finally
560
- enclosingCapturing1 = enclosingCapturing1.tail
551
+ recur(parent1, tp2a)
561
552
else thirdTry
562
553
compareCapturing
563
554
case tp1 : AnnotatedType if ! tp1.isRefining =>
@@ -685,7 +676,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
685
676
686
677
if defn.isFunctionType(tp2) then
687
678
if tp2.derivesFrom(defn.PolyFunctionClass ) then
688
- return isSubInfo(tp1.ccMember (nme.apply).info, tp2.refinedInfo)
679
+ return isSubInfo(tp1.member (nme.apply).info, tp2.refinedInfo)
689
680
else
690
681
tp1w.widenDealias match
691
682
case tp1 : RefinedType =>
@@ -2038,7 +2029,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2038
2029
* rebase both itself and the member info of `tp` on a freshly created skolem type.
2039
2030
*/
2040
2031
def hasMatchingMember (name : Name , tp1 : Type , tp2 : RefinedType ): Boolean =
2041
- trace(i " hasMatchingMember( $tp1 . $name :? ${tp2.refinedInfo}), mbr: ${tp1.ccMember (name).info}" , subtyping) {
2032
+ trace(i " hasMatchingMember( $tp1 . $name :? ${tp2.refinedInfo}), mbr: ${tp1.member (name).info}" , subtyping) {
2042
2033
2043
2034
// If the member is an abstract type and the prefix is a path, compare the member itself
2044
2035
// instead of its bounds. This case is needed situations like:
@@ -2119,30 +2110,9 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2119
2110
|| (tp1.isStable && m.symbol.isStableMember && isSubType(TermRef (tp1, m.symbol), tp2.refinedInfo))
2120
2111
end qualifies
2121
2112
2122
- tp1.ccMember (name).hasAltWithInline(qualifies)
2113
+ tp1.member (name).hasAltWithInline(qualifies)
2123
2114
}
2124
2115
2125
- extension (qual : Type )
2126
- /** Add all directly enclosing capture sets to `qual` and select `name` on the
2127
- * resulting type. A capture set is directly enclosing if there is an enclosing
2128
- * capturing type with the set and all types between `qual` and that type
2129
- * are RefinedTypes or CapturingTypes.
2130
- */
2131
- def ccMember (name : Name ): Denotation =
2132
- def isEnclosing (tp : Type ): Boolean = tp match
2133
- case RefinedType (parent, _, _) => isEnclosing(parent)
2134
- case CapturingType (parent, _) => isEnclosing(parent)
2135
- case _ => tp eq qual
2136
-
2137
- def addCaptures (tp : Type , encls : List [AnnotatedType ]): Type = encls match
2138
- case (ct @ CapturingType (parent, refs)) :: encls1 if isEnclosing(parent) =>
2139
- addCaptures(CapturingType (tp, refs, ct.isBoxedCapturing), encls1)
2140
- case _ =>
2141
- tp
2142
-
2143
- addCaptures(qual, enclosingCapturing1).member(name)
2144
- end ccMember
2145
-
2146
2116
final def ensureStableSingleton (tp : Type ): SingletonType = tp.stripTypeVar match {
2147
2117
case tp : SingletonType if tp.isStable => tp
2148
2118
case tp : ValueType => SkolemType (tp)
@@ -3418,7 +3388,7 @@ class ExplainingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
3418
3388
}
3419
3389
3420
3390
override def hasMatchingMember (name : Name , tp1 : Type , tp2 : RefinedType ): Boolean =
3421
- traceIndented(s " hasMatchingMember( ${show(tp1)} . $name, ${show(tp2.refinedInfo)}), member = ${show(tp1.ccMember (name).info)}" ) {
3391
+ traceIndented(s " hasMatchingMember( ${show(tp1)} . $name, ${show(tp2.refinedInfo)}), member = ${show(tp1.member (name).info)}" ) {
3422
3392
super .hasMatchingMember(name, tp1, tp2)
3423
3393
}
3424
3394
0 commit comments