Merged
Conversation
3348b8f to
2dc8ada
Compare
odersky
requested changes
Aug 21, 2025
| lazy val isRefInSignatures = | ||
| psym.maybeOwner.isPrimaryConstructor | ||
| && isReferencedInPublicSignatures(psym) | ||
| lazy val needsTrackedSimp = needsTrackedSimple(psym, param, owningSym) |
Contributor
There was a problem hiding this comment.
I don't see why you need a lazy val here? A def would do as weell and be more efficient? Or just inline the rhs.
| && psym.info.memberNames(abstractTypeNameFilter).nonEmpty | ||
| && !accessorSyms.exists(_.is(Mutable)) | ||
| && (param.hasAttachment(ContextBoundParam) || accessorSyms.exists(!_.isOneOf(PrivateLocal))) | ||
| && psym.infoDontForceAnnotsAndInferred(param).memberNames(abstractTypeNameFilter).nonEmpty |
Contributor
There was a problem hiding this comment.
Why not: abstractTypeNames.nonEmpty?
| sym.infoOrCompleter match | ||
| case tpe if tree.mods.annotations.nonEmpty => tpe | ||
| case tpe: LazyType if tpe.isExplicit => sym.info | ||
| case tpe if sym.isType => sym.info |
Contributor
There was a problem hiding this comment.
Is this not rendundant wrt the last line?
| acc(false, tpe) | ||
| private def infoDontForceAnnotsAndInferred(tree: DefTree)(using Context): Type = | ||
| sym.infoOrCompleter match | ||
| case tpe if tree.mods.annotations.nonEmpty => tpe |
Contributor
There was a problem hiding this comment.
Can we find a more finegrained exclusion that avoids the NoSymbol?
| @@ -0,0 +1,6 @@ | |||
| import scala.language.experimental.modularity | |||
Contributor
There was a problem hiding this comment.
Would be good to add some more tests that exercise the precise conditions that infer tracked.
606bfe9 to
f1b836e
Compare
Break out code for testing tracked inference independently of x.modularity
Check parameters whether they need to be tracked only under x.modularity.
f1b836e to
069dd61
Compare
odersky
approved these changes
Oct 13, 2025
Contributor
odersky
left a comment
There was a problem hiding this comment.
I did some changes to simplify it further and update the doc page to reflect the new behavior.
Contributor
|
Summary of changes over original PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
trackedinference to simpler heuristic: always infertrackedfor a parameter if its type has an abstract type member.Tested it with
modularityturned on and the only bug I noticed was eager typing of annotations, which I patched by not inferringtrackedfor annotated parameters.