File tree 3 files changed +7
-10
lines changed
compiler/src/dotty/tools/dotc
3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -525,7 +525,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
525
525
def makeRetaining (parent : Tree , refs : List [Tree ], annotName : TypeName )(using Context ): Annotated =
526
526
Annotated (parent, New (scalaAnnotationDot(annotName), List (refs)))
527
527
528
- def makeCapsOf (tp : Tree )(using Context ): Tree =
528
+ def makeCapsOf (tp : RefTree )(using Context ): Tree =
529
529
TypeApply (Select (scalaDot(nme.caps), nme.capsOf), tp :: Nil )
530
530
531
531
def makeCapsBound ()(using Context ): Tree =
Original file line number Diff line number Diff line change @@ -194,8 +194,7 @@ extension (tp: Type)
194
194
true
195
195
case tp : TermRef =>
196
196
((tp.prefix eq NoPrefix )
197
- || tp.symbol.isField && ! tp.symbol.isStatic && (
198
- tp.prefix.isThisTypeOf(tp.symbol.owner) || tp.prefix.isTrackableRef)
197
+ || tp.symbol.isField && ! tp.symbol.isStatic && tp.prefix.isTrackableRef
199
198
|| tp.isRootCapability
200
199
) && ! tp.symbol.isOneOf(UnstableValueFlags )
201
200
case tp : TypeRef =>
Original file line number Diff line number Diff line change @@ -1548,22 +1548,20 @@ object Parsers {
1548
1548
case _ => None
1549
1549
}
1550
1550
1551
- /** CaptureRef ::= (ident | `this`) [`*` | `^`]
1551
+ /** CaptureRef ::= SimpleRef { `.` id } [`*` | `^`]
1552
1552
*/
1553
1553
def captureRef (): Tree =
1554
- val ref = singleton( )
1554
+ val ref = dotSelectors(simpleRef() )
1555
1555
if isIdent(nme.raw.STAR ) then
1556
1556
in.nextToken()
1557
1557
atSpan(startOffset(ref)):
1558
1558
PostfixOp (ref, Ident (nme.CC_REACH ))
1559
1559
else if isIdent(nme.UPARROW ) then
1560
1560
in.nextToken()
1561
- def toTypeSel (r : Tree ): Tree = r match
1562
- case id : Ident => cpy.Ident (id)(id.name.toTypeName)
1563
- case Select (qual, id) => Select (qual, id.toTypeName)
1564
- case _ => r
1565
1561
atSpan(startOffset(ref)):
1566
- makeCapsOf(toTypeSel(ref))
1562
+ convertToTypeId(ref) match
1563
+ case ref : RefTree => makeCapsOf(ref)
1564
+ case ref => ref
1567
1565
else ref
1568
1566
1569
1567
/** CaptureSet ::= `{` CaptureRef {`,` CaptureRef} `}` -- under captureChecking
You can’t perform that action at this time.
0 commit comments