File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -524,7 +524,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
524
524
def makeRetaining (parent : Tree , refs : List [Tree ], annotName : TypeName )(using Context ): Annotated =
525
525
Annotated (parent, New (scalaAnnotationDot(annotName), List (refs)))
526
526
527
- def makeCapsOf (tp : Tree )(using Context ): Tree =
527
+ def makeCapsOf (tp : RefTree )(using Context ): Tree =
528
528
TypeApply (Select (scalaDot(nme.caps), nme.capsOf), tp :: Nil )
529
529
530
530
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 @@ -1559,22 +1559,20 @@ object Parsers {
1559
1559
case _ => None
1560
1560
}
1561
1561
1562
- /** CaptureRef ::= (ident | `this`) [`*` | `^`]
1562
+ /** CaptureRef ::= SimpleRef { `.` id } [`*` | `^`]
1563
1563
*/
1564
1564
def captureRef (): Tree =
1565
- val ref = singleton( )
1565
+ val ref = dotSelectors(simpleRef() )
1566
1566
if isIdent(nme.raw.STAR ) then
1567
1567
in.nextToken()
1568
1568
atSpan(startOffset(ref)):
1569
1569
PostfixOp (ref, Ident (nme.CC_REACH ))
1570
1570
else if isIdent(nme.UPARROW ) then
1571
1571
in.nextToken()
1572
- def toTypeSel (r : Tree ): Tree = r match
1573
- case id : Ident => cpy.Ident (id)(id.name.toTypeName)
1574
- case Select (qual, id) => Select (qual, id.toTypeName)
1575
- case _ => r
1576
1572
atSpan(startOffset(ref)):
1577
- makeCapsOf(toTypeSel(ref))
1573
+ convertToTypeId(ref) match
1574
+ case ref : RefTree => makeCapsOf(ref)
1575
+ case ref => ref
1578
1576
else ref
1579
1577
1580
1578
/** CaptureSet ::= `{` CaptureRef {`,` CaptureRef} `}` -- under captureChecking
You can’t perform that action at this time.
0 commit comments