File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed
compiler/src/dotty/tools/dotc/core
tests/pos-custom-args/captures/captureRef-separate-compilation Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -135,5 +135,14 @@ class TypeUtils {
135135 case _ =>
136136 val cls = self.underlyingClassRef(refinementOK = false ).typeSymbol
137137 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
138147 }
139148}
Original file line number Diff line number Diff line change @@ -2991,7 +2991,7 @@ object Types extends TypeUtils {
29912991 */
29922992 override def isTrackableRef (using Context ) =
29932993 ((prefix eq NoPrefix )
2994- || symbol.is(ParamAccessor ) && ( prefix eq symbol.owner.thisType )
2994+ || symbol.is(ParamAccessor ) && prefix.isThisTypeOf( symbol.owner)
29952995 || isRootCapability
29962996 ) && ! symbol.isOneOf(UnstableValueFlags )
29972997
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