Skip to content

Commit e370395

Browse files
committed
Harden isTrackableRef
isTrackableRef started failing again due to undserlying NoDenotations after #22839 was merged. We now check also TermRefs for missing denotations.
1 parent 9f63495 commit e370395

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

+6-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ extension (tp: Type)
104104
final def isTrackableRef(using Context): Boolean = tp match
105105
case _: (ThisType | TermParamRef) => true
106106
case tp: TermRef =>
107-
((tp.prefix eq NoPrefix)
108-
|| tp.symbol.isField && !tp.symbol.isStatic && tp.prefix.isTrackableRef
109-
|| tp.isCap
110-
) && !tp.symbol.isOneOf(UnstableValueFlags)
107+
!tp.underlying.exists // might happen during construction of lambdas with annotations on parameters
108+
||
109+
((tp.prefix eq NoPrefix)
110+
|| tp.symbol.isField && !tp.symbol.isStatic && tp.prefix.isTrackableRef
111+
|| tp.isCap
112+
) && !tp.symbol.isOneOf(UnstableValueFlags)
111113
case tp: TypeRef =>
112114
tp.symbol.isType && tp.derivesFrom(defn.Caps_CapSet)
113115
case tp: TypeParamRef =>

0 commit comments

Comments
 (0)