File tree 4 files changed +20
-1
lines changed
compiler/src/dotty/tools/dotc/core
tests/pos-custom-args/captures/captureRef-separate-compilation
4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -135,5 +135,14 @@ class TypeUtils {
135
135
case _ =>
136
136
val cls = self.underlyingClassRef(refinementOK = false ).typeSymbol
137
137
cls.isTransparentClass && (! traitOnly || cls.is(Trait ))
138
+
139
+ /** Is this type the ThisType of class `cls?`. Note we can't use `self eq cls.thisType` for this,
140
+ * since ThisTypes take TermRef parameters and semantically equal TermRefs could have different
141
+ * forms (for instance one could use as a prefix the ThisType of an enclosing static module or package,
142
+ * and the other could select it from something further out)
143
+ */
144
+ def isThisTypeOf (cls : Symbol )(using Context ) = self match
145
+ case self : Types .ThisType => self.cls == cls
146
+ case _ => false
138
147
}
139
148
}
Original file line number Diff line number Diff line change @@ -2991,7 +2991,7 @@ object Types extends TypeUtils {
2991
2991
*/
2992
2992
override def isTrackableRef (using Context ) =
2993
2993
((prefix eq NoPrefix )
2994
- || symbol.is(ParamAccessor ) && ( prefix eq symbol.owner.thisType )
2994
+ || symbol.is(ParamAccessor ) && prefix.isThisTypeOf( symbol.owner)
2995
2995
|| isRootCapability
2996
2996
) && ! symbol.isOneOf(UnstableValueFlags )
2997
2997
Original file line number Diff line number Diff line change
1
+ class Future [T ]
2
+ object Future :
3
+ class Collector [T ](fs : (Future [T ]^ )* )
4
+ class MutableCollector [T ](val futures : (Future [T ]^ )* ) extends Collector [T ](futures* ):
5
+ def add (future : Future [T ]^ {futures* }) = ???
Original file line number Diff line number Diff line change
1
+ def test =
2
+ val collector : Future .MutableCollector [Int ] = Future .MutableCollector ()
3
+ collector.add(??? )
4
+
5
+
You can’t perform that action at this time.
0 commit comments