@@ -1791,7 +1791,6 @@ class Namer { typer: Typer =>
17911791 sym.owner.typeParams.foreach(_.ensureCompleted())
17921792 completeTrailingParamss(constr, sym, indexingCtor = true )
17931793 if Feature .enabled(modularity) then
1794- // println(i"[indexConstructor] Checking if params of $constr need tracked")
17951794 constr.termParamss.foreach(_.foreach(setTracked))
17961795
17971796 /** The signature of a module valdef.
@@ -2000,7 +1999,8 @@ class Namer { typer: Typer =>
20001999 cls.srcPos)
20012000 case _ =>
20022001
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
20042004 */
20052005 def needsTracked (psym : Symbol , param : ValDef , owningSym : Symbol )(using Context ) =
20062006 lazy val abstractContextBound = isContextBoundWitnessWithAbstractMembers(psym, param, owningSym)
@@ -2025,6 +2025,7 @@ class Namer { typer: Typer =>
20252025 extension (sym : Symbol )
20262026 def infoWithForceNonInferingCompleter (using Context ): Type = sym.infoOrCompleter match
20272027 case tpe : LazyType if tpe.isNonInfering => sym.info
2028+ case tpe if sym.isType => sym.info
20282029 case info => info
20292030
20302031 /** Under x.modularity, we add `tracked` to term parameters whose types are referenced
@@ -2036,9 +2037,11 @@ class Namer { typer: Typer =>
20362037 def checkOwnerMemberSignatures (owner : Symbol ): Boolean =
20372038 owner.infoOrCompleter match
20382039 case info : ClassInfo =>
2039- info.decls.filter(_.isTerm).filter(_. isPublic)
2040+ info.decls.filter(_.isPublic)
20402041 .filter(_ != sym.maybeOwner)
2041- .exists(d => tpeContainsSymbolRef(d.infoWithForceNonInferingCompleter, accessorSyms))
2042+ .exists { decl =>
2043+ tpeContainsSymbolRef(decl.infoWithForceNonInferingCompleter, accessorSyms)
2044+ }
20422045 case _ => false
20432046 checkOwnerMemberSignatures(owner)
20442047
@@ -2056,7 +2059,7 @@ class Namer { typer: Typer =>
20562059 private def maybeParamAccessors (owner : Symbol , sym : Symbol )(using Context ): List [Symbol ] = owner.infoOrCompleter match
20572060 case info : ClassInfo =>
20582061 info.decls.lookupAll(sym.name).filter(d => d.is(ParamAccessor )).toList
2059- case _ => List .empty
2062+ case _ => List (sym)
20602063
20612064 /** Under x.modularity, set every context bound evidence parameter of a class to be tracked,
20622065 * provided it has a type that has an abstract type member. Reset private and local flags
0 commit comments