Skip to content

Commit

Permalink
Disable tracked by default, mark accessors as tracked, when infering …
Browse files Browse the repository at this point in the history
…tracked
  • Loading branch information
KacperFKorban committed Oct 29, 2024
1 parent 71e2cd8 commit 2de8fbf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 88 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/config/Feature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object Feature:
* feature is defined.
*/
def enabled(feature: TermName)(using Context): Boolean =
enabledBySetting(feature) || enabledByImport(feature) || feature == tracked
enabledBySetting(feature) || enabledByImport(feature)

/** Is auto-tupling enabled? */
def autoTuplingEnabled(using Context): Boolean = !enabled(nme.noAutoTupling)
Expand Down
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1931,14 +1931,14 @@ class Namer { typer: Typer =>
def wrapRefinedMethType(restpe: Type): Type =
wrapMethType(addParamRefinements(restpe, paramSymss))

def addTrackedIfNeeded(ddef: DefDef, owningSym: Symbol): Boolean =
var wasSet = false
def addTrackedIfNeeded(ddef: DefDef, owningSym: Symbol): Unit =
for params <- ddef.termParamss; param <- params do
val psym = symbolOfTree(param)
if needsTracked(psym, param, owningSym) then
psym.setFlag(Tracked)
wasSet = true
wasSet
for acc <- sym.maybeOwner.infoOrCompleter.decls.lookupAll(psym.name) if acc.is(ParamAccessor) do
acc.resetFlag(PrivateLocal)
acc.setFlag(Tracked)

if Feature.trackedEnabled then addTrackedIfNeeded(ddef, sym.maybeOwner)

Expand Down
1 change: 0 additions & 1 deletion tests/pos/infer-tracked-parsercombinators-givens.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ given apply: [C, E] => Combinator[Apply[C, E]] {
}
}

// TODO(kπ) infer tracked correctly here
given combine[A, B](using
tracked val f: Combinator[A],
tracked val s: Combinator[B] { type Context = f.Context }
Expand Down
82 changes: 0 additions & 82 deletions tests/pos/infer-tracked-vector.scala

This file was deleted.

0 comments on commit 2de8fbf

Please sign in to comment.