@@ -1791,7 +1791,6 @@ class Namer { typer: Typer =>
1791
1791
sym.owner.typeParams.foreach(_.ensureCompleted())
1792
1792
completeTrailingParamss(constr, sym, indexingCtor = true )
1793
1793
if Feature .enabled(modularity) then
1794
- // println(i"[indexConstructor] Checking if params of $constr need tracked")
1795
1794
constr.termParamss.foreach(_.foreach(setTracked))
1796
1795
1797
1796
/** The signature of a module valdef.
@@ -2000,7 +1999,8 @@ class Namer { typer: Typer =>
2000
1999
cls.srcPos)
2001
2000
case _ =>
2002
2001
2003
- /** Try to infer if the parameter needs a `tracked` modifier
2002
+ /** `psym` needs tracked if it is referenced in any of the public signatures of the defining class
2003
+ * or when `psym` is a context bound witness with an abstract type member
2004
2004
*/
2005
2005
def needsTracked (psym : Symbol , param : ValDef , owningSym : Symbol )(using Context ) =
2006
2006
lazy val abstractContextBound = isContextBoundWitnessWithAbstractMembers(psym, param, owningSym)
@@ -2025,6 +2025,7 @@ class Namer { typer: Typer =>
2025
2025
extension (sym : Symbol )
2026
2026
def infoWithForceNonInferingCompleter (using Context ): Type = sym.infoOrCompleter match
2027
2027
case tpe : LazyType if tpe.isNonInfering => sym.info
2028
+ case tpe if sym.isType => sym.info
2028
2029
case info => info
2029
2030
2030
2031
/** Under x.modularity, we add `tracked` to term parameters whose types are referenced
@@ -2036,9 +2037,11 @@ class Namer { typer: Typer =>
2036
2037
def checkOwnerMemberSignatures (owner : Symbol ): Boolean =
2037
2038
owner.infoOrCompleter match
2038
2039
case info : ClassInfo =>
2039
- info.decls.filter(_.isTerm).filter(_. isPublic)
2040
+ info.decls.filter(_.isPublic)
2040
2041
.filter(_ != sym.maybeOwner)
2041
- .exists(d => tpeContainsSymbolRef(d.infoWithForceNonInferingCompleter, accessorSyms))
2042
+ .exists { decl =>
2043
+ tpeContainsSymbolRef(decl.infoWithForceNonInferingCompleter, accessorSyms)
2044
+ }
2042
2045
case _ => false
2043
2046
checkOwnerMemberSignatures(owner)
2044
2047
@@ -2056,7 +2059,7 @@ class Namer { typer: Typer =>
2056
2059
private def maybeParamAccessors (owner : Symbol , sym : Symbol )(using Context ): List [Symbol ] = owner.infoOrCompleter match
2057
2060
case info : ClassInfo =>
2058
2061
info.decls.lookupAll(sym.name).filter(d => d.is(ParamAccessor )).toList
2059
- case _ => List .empty
2062
+ case _ => List (sym)
2060
2063
2061
2064
/** Under x.modularity, set every context bound evidence parameter of a class to be tracked,
2062
2065
* provided it has a type that has an abstract type member. Reset private and local flags
0 commit comments