diff --git a/compiler/sjs/backend/sjs/JSCodeGen.scala b/compiler/sjs/backend/sjs/JSCodeGen.scala index 25974a641251..2eb8ecadc142 100644 --- a/compiler/sjs/backend/sjs/JSCodeGen.scala +++ b/compiler/sjs/backend/sjs/JSCodeGen.scala @@ -72,7 +72,7 @@ class JSCodeGen()(implicit ctx: Context) { /* See genSuperCall() * TODO Can we avoid this unscoped var? */ - private var isModuleInitialized: Boolean = false + private[this] var isModuleInitialized: Boolean = false private def currentClassType = encodeClassType(currentClassSym) diff --git a/compiler/sjs/backend/sjs/ScopedVar.scala b/compiler/sjs/backend/sjs/ScopedVar.scala index 0e47f7b7946b..ac2dacd4a7df 100644 --- a/compiler/sjs/backend/sjs/ScopedVar.scala +++ b/compiler/sjs/backend/sjs/ScopedVar.scala @@ -5,7 +5,7 @@ import language.implicitConversions class ScopedVar[A](init: A) { import ScopedVar.Assignment - private var value = init + private[this] var value = init def this()(implicit ev: Null <:< A) = this(ev(null)) diff --git a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala index 53bb55118e24..ad84bde680d1 100644 --- a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala +++ b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala @@ -77,9 +77,9 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter // class BCodePhase() { - private var bytecodeWriter : BytecodeWriter = null - private var mirrorCodeGen : JMirrorBuilder = null - private var beanInfoCodeGen : JBeanInfoBuilder = null + private[this] var bytecodeWriter : BytecodeWriter = null + private[this] var mirrorCodeGen : JMirrorBuilder = null + private[this] var beanInfoCodeGen : JBeanInfoBuilder = null /* ---------------- q1 ---------------- */ diff --git a/compiler/src/dotty/tools/dotc/Bench.scala b/compiler/src/dotty/tools/dotc/Bench.scala index a5fe890b8119..836a575b6faf 100644 --- a/compiler/src/dotty/tools/dotc/Bench.scala +++ b/compiler/src/dotty/tools/dotc/Bench.scala @@ -10,7 +10,7 @@ import reporting.Reporter */ object Bench extends Driver { - @sharable private var numRuns = 1 + @sharable private[this] var numRuns = 1 private def ntimes(n: Int)(op: => Reporter): Reporter = (emptyReporter /: (0 until n)) ((_, _) => op) diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index 9eba3377fe26..0fb504f62d12 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -33,7 +33,7 @@ object Trees { /** Property key for trees with documentation strings attached */ val DocComment = new Property.Key[Comment] - @sharable private var nextId = 0 // for debugging + @sharable private[this] var nextId = 0 // for debugging type LazyTree = AnyRef /* really: Tree | Lazy[Tree] */ type LazyTreeList = AnyRef /* really: List[Tree] | Lazy[List[Tree]] */ diff --git a/compiler/src/dotty/tools/dotc/ast/untpd.scala b/compiler/src/dotty/tools/dotc/ast/untpd.scala index 4466a8342da2..bf40539679ec 100644 --- a/compiler/src/dotty/tools/dotc/ast/untpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/untpd.scala @@ -209,7 +209,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { */ abstract class DerivedTypeTree extends TypeTree { - private var myWatched: Tree = EmptyTree + private[this] var myWatched: Tree = EmptyTree /** The watched tree; used only for printing */ def watched: Tree = myWatched diff --git a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala index d2a8e18a2a9d..03eb441852f0 100644 --- a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala +++ b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala @@ -11,7 +11,7 @@ import transform.ExplicitOuter, transform.SymUtils._ class JavaPlatform extends Platform { - private var currentClassPath: Option[ClassPath] = None + private[this] var currentClassPath: Option[ClassPath] = None def classPath(implicit ctx: Context): ClassPath = { if (currentClassPath.isEmpty) diff --git a/compiler/src/dotty/tools/dotc/config/OutputDirs.scala b/compiler/src/dotty/tools/dotc/config/OutputDirs.scala index a87eb9bce1f3..87ba6a7f8349 100644 --- a/compiler/src/dotty/tools/dotc/config/OutputDirs.scala +++ b/compiler/src/dotty/tools/dotc/config/OutputDirs.scala @@ -12,12 +12,12 @@ import io._ */ class OutputDirs { /** Pairs of source directory - destination directory. */ - private var outputDirs: List[(AbstractFile, AbstractFile)] = Nil + private[this] var outputDirs: List[(AbstractFile, AbstractFile)] = Nil /** If this is not None, the output location where all * classes should go. */ - private var singleOutDir: Option[AbstractFile] = None + private[this] var singleOutDir: Option[AbstractFile] = None /** Add a destination directory for sources found under srcdir. * Both directories should exits. diff --git a/compiler/src/dotty/tools/dotc/config/Settings.scala b/compiler/src/dotty/tools/dotc/config/Settings.scala index 6b6c4d15391a..5d979fdf8601 100644 --- a/compiler/src/dotty/tools/dotc/config/Settings.scala +++ b/compiler/src/dotty/tools/dotc/config/Settings.scala @@ -25,8 +25,8 @@ object Settings { val DirectoryTag = ClassTag(classOf[Directory]) class SettingsState(initialValues: Seq[Any]) { - private var values = ArrayBuffer(initialValues: _*) - private var _wasRead: Boolean = false + private[this] var values = ArrayBuffer(initialValues: _*) + private[this] var _wasRead: Boolean = false override def toString = s"SettingsState(values: ${values.toList})" @@ -68,7 +68,7 @@ object Settings { depends: List[(Setting[_], Any)] = Nil, propertyClass: Option[Class[_]] = None)(private[Settings] val idx: Int) { - private var changed: Boolean = false + private[this] var changed: Boolean = false def withAbbreviation(abbrv: String): Setting[T] = copy(aliases = aliases :+ abbrv)(idx) diff --git a/compiler/src/dotty/tools/dotc/core/Annotations.scala b/compiler/src/dotty/tools/dotc/core/Annotations.scala index 8b5b398242e4..83f1cc9d2af9 100644 --- a/compiler/src/dotty/tools/dotc/core/Annotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Annotations.scala @@ -38,7 +38,7 @@ object Annotations { override def symbol(implicit ctx: Context): Symbol def complete(implicit ctx: Context): Tree - private var myTree: Tree = null + private[this] var myTree: Tree = null def tree(implicit ctx: Context) = { if (myTree == null) myTree = complete(ctx) myTree @@ -62,8 +62,8 @@ object Annotations { } case class LazyBodyAnnotation(private var bodyExpr: Context => Tree) extends BodyAnnotation { - private var evaluated = false - private var myBody: Tree = _ + private[this] var evaluated = false + private[this] var myBody: Tree = _ def tree(implicit ctx: Context) = { if (evaluated) assert(myBody != null) else { diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala index 25f6a05a36e8..6c75ee82a851 100644 --- a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala +++ b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala @@ -30,7 +30,7 @@ trait ConstraintHandling { val state: TyperState import state.constraint - private var addConstraintInvocations = 0 + private[this] var addConstraintInvocations = 0 /** If the constraint is frozen we cannot add new bounds to the constraint. */ protected var frozenConstraint = false diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala b/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala index e0f659cc6504..041faf911857 100644 --- a/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala +++ b/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala @@ -5,8 +5,8 @@ import Contexts._ import config.Printers.typr trait ConstraintRunInfo { self: RunInfo => - private var maxSize = 0 - private var maxConstraint: Constraint = _ + private[this] var maxSize = 0 + private[this] var maxConstraint: Constraint = _ def recordConstraintSize(c: Constraint, size: Int) = if (size > maxSize) { maxSize = size diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index 00b9507bf723..0fd08bf5649d 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -160,12 +160,12 @@ object Contexts { /** An optional diagostics buffer than is used by some checking code * to provide more information in the buffer if it exists. */ - private var _diagnostics: Option[StringBuilder] = _ + private[this] var _diagnostics: Option[StringBuilder] = _ protected def diagnostics_=(diagnostics: Option[StringBuilder]) = _diagnostics = diagnostics def diagnostics: Option[StringBuilder] = _diagnostics /** The current bounds in force for type parameters appearing in a GADT */ - private var _gadt: GADTMap = _ + private[this] var _gadt: GADTMap = _ protected def gadt_=(gadt: GADTMap) = _gadt = gadt def gadt: GADTMap = _gadt @@ -175,14 +175,14 @@ object Contexts { def freshNames: FreshNameCreator = _freshNames /** A map in which more contextual properties can be stored */ - private var _moreProperties: Map[Key[Any], Any] = _ + private[this] var _moreProperties: Map[Key[Any], Any] = _ protected def moreProperties_=(moreProperties: Map[Key[Any], Any]) = _moreProperties = moreProperties def moreProperties: Map[Key[Any], Any] = _moreProperties def property[T](key: Key[T]): Option[T] = moreProperties.get(key).asInstanceOf[Option[T]] - private var _typeComparer: TypeComparer = _ + private[this] var _typeComparer: TypeComparer = _ protected def typeComparer_=(typeComparer: TypeComparer) = _typeComparer = typeComparer def typeComparer: TypeComparer = { if (_typeComparer.ctx ne this) @@ -224,7 +224,7 @@ object Contexts { } /** The history of implicit searches that are currently active */ - private var _searchHistory: SearchHistory = null + private[this] var _searchHistory: SearchHistory = null protected def searchHistory_= (searchHistory: SearchHistory) = _searchHistory = searchHistory def searchHistory: SearchHistory = _searchHistory @@ -233,8 +233,8 @@ object Contexts { * phasedCtxs is array that uses phaseId's as indexes, * contexts are created only on request and cached in this array */ - private var phasedCtx: Context = _ - private var phasedCtxs: Array[Context] = _ + private[this] var phasedCtx: Context = _ + private[this] var phasedCtxs: Array[Context] = _ /** This context at given phase. * This method will always return a phase period equal to phaseId, thus will never return squashed phases @@ -268,7 +268,7 @@ object Contexts { /** If -Ydebug is on, the top of the stack trace where this context * was created, otherwise `null`. */ - private var creationTrace: Array[StackTraceElement] = _ + private[this] var creationTrace: Array[StackTraceElement] = _ private def setCreationTrace() = if (this.settings.YtraceContextCreation.value) @@ -393,7 +393,7 @@ object Contexts { /** A condensed context containing essential information of this but * no outer contexts except the initial context. - private var _condensed: CondensedContext = null + private[this] var _condensed: CondensedContext = null def condensed: CondensedContext = { if (_condensed eq outer.condensed) _condensed = base.initialCtx.fresh @@ -557,7 +557,7 @@ object Contexts { val loaders = new SymbolLoaders /** The platform, initialized by `initPlatform()`. */ - private var _platform: Platform = _ + private[this] var _platform: Platform = _ /** The platform */ def platform: Platform = { @@ -670,7 +670,7 @@ object Contexts { // Test that access is single threaded /** The thread on which `checkSingleThreaded was invoked last */ - @sharable private var thread: Thread = null + @sharable private[this] var thread: Thread = null /** Check that we are on the same thread as before */ def checkSingleThreaded() = @@ -695,7 +695,7 @@ object Contexts { } class GADTMap(initBounds: SimpleIdentityMap[Symbol, TypeBounds]) extends util.DotClass { - private var myBounds = initBounds + private[this] var myBounds = initBounds def setBounds(sym: Symbol, b: TypeBounds): Unit = myBounds = myBounds.updated(sym, b) def bounds = myBounds diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index b7f67903e3c4..bc97b86de979 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -950,8 +950,8 @@ class Definitions { /** This class would also be obviated by the implicit function type design */ class PerRun[T](generate: Context => T) { - private var current: RunId = NoRunId - private var cached: T = _ + private[this] var current: RunId = NoRunId + private[this] var cached: T = _ def apply()(implicit ctx: Context): T = { if (current != ctx.runId) { cached = generate(ctx) diff --git a/compiler/src/dotty/tools/dotc/core/Denotations.scala b/compiler/src/dotty/tools/dotc/core/Denotations.scala index 42516c07eecc..c3294acc1621 100644 --- a/compiler/src/dotty/tools/dotc/core/Denotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Denotations.scala @@ -1122,9 +1122,9 @@ object Denotations { */ def filterExcluded(excluded: FlagSet)(implicit ctx: Context): PreDenotation - private var cachedPrefix: Type = _ - private var cachedAsSeenFrom: AsSeenFromResult = _ - private var validAsSeenFrom: Period = Nowhere + private[this] var cachedPrefix: Type = _ + private[this] var cachedAsSeenFrom: AsSeenFromResult = _ + private[this] var validAsSeenFrom: Period = Nowhere type AsSeenFromResult <: PreDenotation /** The denotation with info(s) as seen from prefix type */ diff --git a/compiler/src/dotty/tools/dotc/core/Names.scala b/compiler/src/dotty/tools/dotc/core/Names.scala index ed941a1b879f..af92bbb4ecdb 100644 --- a/compiler/src/dotty/tools/dotc/core/Names.scala +++ b/compiler/src/dotty/tools/dotc/core/Names.scala @@ -189,7 +189,7 @@ object Names { def underlying: TermName = unsupported("underlying") @sharable // because of synchronized block in `and` - private var derivedNames: AnyRef /* immutable.Map[NameInfo, DerivedName] | j.u.HashMap */ = + private[this] var derivedNames: AnyRef /* immutable.Map[NameInfo, DerivedName] | j.u.HashMap */ = immutable.Map.empty[NameInfo, DerivedName] private def getDerived(info: NameInfo): DerivedName /* | Null */= derivedNames match { @@ -537,15 +537,15 @@ object Names { /** The number of characters filled. */ @sharable // because it's only mutated in synchronized block of termName - private var nc = 0 + private[this] var nc = 0 /** Hashtable for finding term names quickly. */ @sharable // because it's only mutated in synchronized block of termName - private var table = new Array[SimpleName](InitialHashSize) + private[this] var table = new Array[SimpleName](InitialHashSize) /** The number of defined names. */ @sharable // because it's only mutated in synchronized block of termName - private var size = 1 + private[this] var size = 1 /** The hash of a name made of from characters cs[offset..offset+len-1]. */ private def hashValue(cs: Array[Char], offset: Int, len: Int): Int = diff --git a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala index 609eb743979e..5062bf5c9431 100644 --- a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala +++ b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala @@ -544,7 +544,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds, upperMap.foreachBinding((_, paramss) => paramss.foreach(_.foreach(checkClosedType(_, "upper")))) } - private var myUninstVars: mutable.ArrayBuffer[TypeVar] = _ + private[this] var myUninstVars: mutable.ArrayBuffer[TypeVar] = _ /** The uninstantiated typevars of this constraint */ def uninstVars: collection.Seq[TypeVar] = { diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index a69d0a4e39da..92ed5d75a831 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -318,16 +318,16 @@ object Phases { def exists: Boolean = true - private var myPeriod: Period = Periods.InvalidPeriod - private var myBase: ContextBase = null - private var myErasedTypes = false - private var myFlatClasses = false - private var myRefChecked = false - private var mySymbolicRefs = false - private var myLabelsReordered = false - - private var mySameMembersStartId = NoPhaseId - private var mySameParentsStartId = NoPhaseId + private[this] var myPeriod: Period = Periods.InvalidPeriod + private[this] var myBase: ContextBase = null + private[this] var myErasedTypes = false + private[this] var myFlatClasses = false + private[this] var myRefChecked = false + private[this] var mySymbolicRefs = false + private[this] var myLabelsReordered = false + + private[this] var mySameMembersStartId = NoPhaseId + private[this] var mySameParentsStartId = NoPhaseId /** The sequence position of this phase in the given context where 0 * is reserved for NoPhase and the first real phase is at position 1. diff --git a/compiler/src/dotty/tools/dotc/core/Scopes.scala b/compiler/src/dotty/tools/dotc/core/Scopes.scala index c99ea8aacd31..2dc606bdb6ce 100644 --- a/compiler/src/dotty/tools/dotc/core/Scopes.scala +++ b/compiler/src/dotty/tools/dotc/core/Scopes.scala @@ -210,11 +210,11 @@ object Scopes { /** the hash table */ - private var hashTable: Array[ScopeEntry] = null + private[this] var hashTable: Array[ScopeEntry] = null /** a cache for all elements, to be used by symbol iterator. */ - private var elemsCache: List[Symbol] = null + private[this] var elemsCache: List[Symbol] = null /** The synthesizer to be used, or `null` if no synthesis is done on this scope */ private var synthesize: SymbolSynthesizer = null diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index c886adeebbc1..dbc35be9f6bf 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -1874,9 +1874,9 @@ object SymDenotations { def apply(sym: Symbol) = this def apply(module: TermSymbol, modcls: ClassSymbol) = this - private var myDecls: Scope = EmptyScope - private var mySourceModuleFn: Context => Symbol = NoSymbolFn - private var myModuleClassFn: Context => Symbol = NoSymbolFn + private[this] var myDecls: Scope = EmptyScope + private[this] var mySourceModuleFn: Context => Symbol = NoSymbolFn + private[this] var myModuleClassFn: Context => Symbol = NoSymbolFn /** A proxy to this lazy type that keeps the complete operation * but provides fresh slots for scope/sourceModule/moduleClass @@ -2046,7 +2046,7 @@ object SymDenotations { final def isValid(implicit ctx: Context): Boolean = cache != null && isValidAt(ctx.phase) - private var locked = false + private[this] var locked = false /** Computing parent member names might force parents, which could invalidate * the cache itself. In that case we should cancel invalidation and @@ -2144,9 +2144,9 @@ object SymDenotations { /** A class to combine base data from parent types */ class BaseDataBuilder { - private var classes: List[ClassSymbol] = Nil - private var classIds = new Array[Int](32) - private var length = 0 + private[this] var classes: List[ClassSymbol] = Nil + private[this] var classIds = new Array[Int](32) + private[this] var length = 0 private def resize(size: Int) = { val classIds1 = new Array[Int](size) @@ -2182,5 +2182,5 @@ object SymDenotations { def baseClasses: List[ClassSymbol] = classes } - @sharable private var indent = 0 // for completions printing + @sharable private[this] var indent = 0 // for completions printing } diff --git a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala index 8b0f794cf660..d48f3515267a 100644 --- a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -150,7 +150,7 @@ class SymbolLoaders { override def sourceModule(implicit ctx: Context) = _sourceModule def description(implicit ctx: Context) = "package loader " + sourceModule.fullName - private var enterFlatClasses: Option[Context => Unit] = None + private[this] var enterFlatClasses: Option[Context => Unit] = None Stats.record("package scopes") diff --git a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala index 993feef7f118..b1c1aeb4db3e 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala @@ -111,7 +111,7 @@ object TypeApplications { * produce a higher-kinded application with a type lambda as type constructor. */ class Reducer(tycon: TypeLambda, args: List[Type])(implicit ctx: Context) extends TypeMap { - private var available = (0 until args.length).toSet + private[this] var available = (0 until args.length).toSet var allReplaced = true def hasWildcardArg(p: TypeParamRef) = p.binder == tycon && args(p.paramNum).isInstanceOf[TypeBounds] diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 974dd6b3a36f..d7bc6ddd5835 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -21,10 +21,10 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { val state = ctx.typerState import state.constraint - private var pendingSubTypes: mutable.Set[(Type, Type)] = null - private var recCount = 0 + private[this] var pendingSubTypes: mutable.Set[(Type, Type)] = null + private[this] var recCount = 0 - private var needsGc = false + private[this] var needsGc = false /** Is a subtype check in progress? In that case we may not * permanently instantiate type variables, because the corresponding @@ -41,16 +41,16 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { } /** For statistics: count how many isSubTypes are part of successful comparisons */ - private var successCount = 0 - private var totalCount = 0 + private[this] var successCount = 0 + private[this] var totalCount = 0 - private var myAnyClass: ClassSymbol = null - private var myNothingClass: ClassSymbol = null - private var myNullClass: ClassSymbol = null - private var myPhantomNothingClass: ClassSymbol = null - private var myObjectClass: ClassSymbol = null - private var myAnyType: TypeRef = null - private var myNothingType: TypeRef = null + private[this] var myAnyClass: ClassSymbol = null + private[this] var myNothingClass: ClassSymbol = null + private[this] var myNullClass: ClassSymbol = null + private[this] var myPhantomNothingClass: ClassSymbol = null + private[this] var myObjectClass: ClassSymbol = null + private[this] var myAnyType: TypeRef = null + private[this] var myNothingType: TypeRef = null def AnyClass = { if (myAnyClass == null) myAnyClass = defn.AnyClass @@ -1605,10 +1605,10 @@ object TypeComparer { /** A type comparer that can record traces of subtype operations */ class ExplainingTypeComparer(initctx: Context) extends TypeComparer(initctx) { - private var indent = 0 + private[this] var indent = 0 private val b = new StringBuilder - private var skipped = false + private[this] var skipped = false override def traceIndented[T](str: String)(op: => T): T = if (skipped) op diff --git a/compiler/src/dotty/tools/dotc/core/TyperState.scala b/compiler/src/dotty/tools/dotc/core/TyperState.scala index b804d242edd7..f7e6926cfe92 100644 --- a/compiler/src/dotty/tools/dotc/core/TyperState.scala +++ b/compiler/src/dotty/tools/dotc/core/TyperState.scala @@ -15,7 +15,7 @@ import java.lang.ref.WeakReference class TyperState(previous: TyperState /* | Null */) extends DotClass with Showable { - private var myReporter = + private[this] var myReporter = if (previous == null) new ConsoleReporter() else previous.reporter def reporter: Reporter = myReporter @@ -23,7 +23,7 @@ class TyperState(previous: TyperState /* | Null */) extends DotClass with Showab /** A fresh type state with the same constraint as this one and the given reporter */ def setReporter(reporter: Reporter): this.type = { myReporter = reporter; this } - private var myConstraint: Constraint = + private[this] var myConstraint: Constraint = if (previous == null) new OrderingConstraint(SimpleIdentityMap.Empty, SimpleIdentityMap.Empty, SimpleIdentityMap.Empty) else previous.constraint @@ -36,7 +36,7 @@ class TyperState(previous: TyperState /* | Null */) extends DotClass with Showab private val previousConstraint = if (previous == null) constraint else previous.constraint - private var myEphemeral: Boolean = + private[this] var myEphemeral: Boolean = if (previous == null) false else previous.ephemeral /** The ephemeral flag is set as a side effect if an operation accesses @@ -49,7 +49,7 @@ class TyperState(previous: TyperState /* | Null */) extends DotClass with Showab def ephemeral = myEphemeral def ephemeral_=(x: Boolean): Unit = { myEphemeral = x } - private var myIsCommittable = true + private[this] var myIsCommittable = true def isCommittable = myIsCommittable @@ -58,7 +58,7 @@ class TyperState(previous: TyperState /* | Null */) extends DotClass with Showab def isGlobalCommittable: Boolean = isCommittable && (previous == null || previous.isGlobalCommittable) - private var isCommitted = false + private[this] var isCommitted = false /** A fresh typer state with the same constraint as this one. */ def fresh(): TyperState = @@ -86,7 +86,7 @@ class TyperState(previous: TyperState /* | Null */) extends DotClass with Showab def uncommittedAncestor: TyperState = if (isCommitted) previous.uncommittedAncestor else this - private var testReporter: StoreReporter = null + private[this] var testReporter: StoreReporter = null /** Test using `op`, restoring typerState to previous state afterwards */ def test(op: => Boolean): Boolean = { diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 05ec00ce756c..c013df88ce82 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -41,7 +41,7 @@ import java.lang.ref.WeakReference object Types { - @sharable private var nextId = 0 + @sharable private[this] var nextId = 0 implicit def eqType: Eq[Type, Type] = Eq diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index ac4b108d3391..de6358c0ee3f 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -59,7 +59,7 @@ class ClassfileParser( protected var currentClassName: SimpleName = _ // JVM name of the current class protected var classTParams = Map[Name,Symbol]() - private var Scala2UnpicklingMode = Mode.Scala2Unpickling + private[this] var Scala2UnpicklingMode = Mode.Scala2Unpickling classRoot.info = (new NoCompleter).withDecls(instanceScope) moduleRoot.info = (new NoCompleter).withDecls(staticScope).withSourceModule(_ => staticModule) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyReader.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyReader.scala index 2696077b985e..938c85e10d1c 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyReader.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyReader.scala @@ -18,7 +18,7 @@ class TastyReader(val bytes: Array[Byte], start: Int, end: Int, val base: Int = def this(bytes: Array[Byte]) = this(bytes, 0, bytes.length) - private var bp: Int = start + private[this] var bp: Int = start def addr(idx: Int) = Addr(idx - base) def index(addr: Addr) = addr.index + base diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala index 86e5be2e26f7..5fd72acc8816 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala @@ -12,10 +12,10 @@ class TreeBuffer extends TastyBuffer(50000) { private final val ItemsOverOffsets = 2 private val initialOffsetSize = bytes.length / (AddrWidth * ItemsOverOffsets) - private var offsets = new Array[Int](initialOffsetSize) - private var isRelative = new Array[Boolean](initialOffsetSize) - private var delta: Array[Int] = _ - private var numOffsets = 0 + private[this] var offsets = new Array[Int](initialOffsetSize) + private[this] var isRelative = new Array[Boolean](initialOffsetSize) + private[this] var delta: Array[Int] = _ + private[this] var numOffsets = 0 /** A map from trees to the address at which a tree is pickled. */ private val treeAddrs = new java.util.IdentityHashMap[Tree, Any] // really: Addr | Null diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 0e284d238e6b..301883ab4e2a 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -48,15 +48,15 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi /** The root symbol denotation which are defined by the Tasty file associated with this * TreeUnpickler. Set by `enterTopLevel`. */ - private var roots: Set[SymDenotation] = null + private[this] var roots: Set[SymDenotation] = null /** The root symbols that are defined in this Tasty file. This * is a subset of `roots.map(_.symbol)`. */ - private var seenRoots: Set[Symbol] = Set() + private[this] var seenRoots: Set[Symbol] = Set() /** The root owner tree. See `OwnerTree` class definition. Set by `enterTopLevel`. */ - private var ownerTree: OwnerTree = _ + private[this] var ownerTree: OwnerTree = _ private def registerSym(addr: Addr, sym: Symbol) = symAtAddr(addr) = sym diff --git a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala index dffe81c5216b..6e3206ba684e 100644 --- a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala +++ b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala @@ -38,7 +38,7 @@ class InteractiveDriver(settings: List[String]) extends Driver { ctx } - private var myCtx: Context = myInitCtx + private[this] var myCtx: Context = myInitCtx def currentCtx: Context = myCtx diff --git a/compiler/src/dotty/tools/dotc/parsing/CharArrayReader.scala b/compiler/src/dotty/tools/dotc/parsing/CharArrayReader.scala index 0ecd43263aee..30c15fa75d1a 100644 --- a/compiler/src/dotty/tools/dotc/parsing/CharArrayReader.scala +++ b/compiler/src/dotty/tools/dotc/parsing/CharArrayReader.scala @@ -30,7 +30,7 @@ abstract class CharArrayReader { self => /** The start offset of the line before the current one */ var lastLineStartOffset: Int = startFrom - private var lastUnicodeOffset = -1 + private[this] var lastUnicodeOffset = -1 /** Is last character a unicode escape \\uxxxx? */ def isUnicodeEscape = charOffset == lastUnicodeOffset diff --git a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala index ada049b3d818..2a212b9c4d79 100644 --- a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -39,7 +39,7 @@ object JavaParsers { val in: JavaScanner = new JavaScanner(source) /** The simple name of the package of the currently parsed file */ - private var thisPackageName: TypeName = tpnme.EMPTY + private[this] var thisPackageName: TypeName = tpnme.EMPTY /** This is the general parse entry point. * Overridden by ScriptParser diff --git a/compiler/src/dotty/tools/dotc/parsing/MarkupParsers.scala b/compiler/src/dotty/tools/dotc/parsing/MarkupParsers.scala index 882449412850..a8638270e73e 100644 --- a/compiler/src/dotty/tools/dotc/parsing/MarkupParsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/MarkupParsers.scala @@ -85,7 +85,7 @@ object MarkupParsers { var xEmbeddedBlock = false - private var debugLastStartElement = List.empty[(Int, String)] + private[this] var debugLastStartElement = List.empty[(Int, String)] private def debugLastPos = debugLastStartElement.head._1 private def debugLastElem = debugLastStartElement.head._2 diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index bbca71e4782f..bd15d9faa5e4 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -34,7 +34,7 @@ object Parsers { case class OpInfo(operand: Tree, operator: Ident, offset: Offset) class ParensCounters { - private var parCounts = new Array[Int](lastParen - firstParen) + private[this] var parCounts = new Array[Int](lastParen - firstParen) def count(tok: Token) = parCounts(tok - firstParen) def change(tok: Token, delta: Int) = parCounts(tok - firstParen) += delta @@ -175,7 +175,7 @@ object Parsers { /** The offset of the last time when a statement on a new line was definitely * encountered in the current scope or an outer scope. */ - private var lastStatOffset = -1 + private[this] var lastStatOffset = -1 def setLastStatOffset() = if (mustStartStat && in.isAfterLineEnd()) @@ -297,7 +297,7 @@ object Parsers { def errorTermTree = atPos(in.offset) { Literal(Constant(null)) } - private var inFunReturnType = false + private[this] var inFunReturnType = false private def fromWithinReturnType[T](body: => T): T = { val saved = inFunReturnType try { @@ -312,7 +312,7 @@ object Parsers { /** A flag indicating we are parsing in the annotations of a primary * class constructor */ - private var inClassConstrAnnots = false + private[this] var inClassConstrAnnots = false private def fromWithinClassConstr[T](body: => T): T = { val saved = inClassConstrAnnots @@ -332,7 +332,7 @@ object Parsers { * We store tokens in lookahead as long as they can form a valid prefix * of a class parameter clause. */ - private var lookaheadTokens = new ListBuffer[TokenData] + private[this] var lookaheadTokens = new ListBuffer[TokenData] /** Copy current token to end of lookahead */ private def saveLookahead() = { diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index f0ad4fedf0d3..d49eecee7637 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -224,7 +224,7 @@ object Scanners { /** The parser can also add more lookahead tokens via `insertTokens`. * Tokens beyond `next` are stored in `following`. */ - private var following: List[TokenData] = Nil + private[this] var following: List[TokenData] = Nil /** Push a copy of token data `td` to `following` */ private def pushCopy(td: TokenData) = { diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index 6294bacf3417..fc291a7b5620 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -17,7 +17,7 @@ import scala.annotation.switch class PlainPrinter(_ctx: Context) extends Printer { protected[this] implicit def ctx: Context = _ctx.addMode(Mode.Printing) - private var openRecs: List[RecType] = Nil + private[this] var openRecs: List[RecType] = Nil protected def maxToTextRecursions = 100 @@ -526,7 +526,7 @@ class PlainPrinter(_ctx: Context) extends Printer { } - private var maxSummarized = Int.MaxValue + private[this] var maxSummarized = Int.MaxValue def summarized[T](depth: Int)(op: => T): T = { val saved = maxSummarized diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala index fb0214e7b47d..8e4e3fc160f1 100644 --- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -20,9 +20,9 @@ import language.implicitConversions class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { /** A stack of enclosing DefDef, TypeDef, or ClassDef, or ModuleDefs nodes */ - private var enclosingDef: untpd.Tree = untpd.EmptyTree - private var myCtx: Context = _ctx - private var printPos = ctx.settings.Yprintpos.value + private[this] var enclosingDef: untpd.Tree = untpd.EmptyTree + private[this] var myCtx: Context = _ctx + private[this] var printPos = ctx.settings.Yprintpos.value override protected[this] implicit def ctx: Context = myCtx def withEnclosingDef(enclDef: Tree[_ >: Untyped])(op: => Text): Text = { diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index 41736906ca5f..43ffb3328a17 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -190,7 +190,7 @@ abstract class Reporter extends interfaces.ReporterResult { * debugging information (like printing the classpath) is not rendered * invisible due to the max message length. */ - private var _truncationOK: Boolean = true + private[this] var _truncationOK: Boolean = true def truncationOK = _truncationOK def withoutTruncating[T](body: => T): T = { val saved = _truncationOK @@ -200,7 +200,7 @@ abstract class Reporter extends interfaces.ReporterResult { } type ErrorHandler = MessageContainer => Context => Unit - private var incompleteHandler: ErrorHandler = d => c => report(d)(c) + private[this] var incompleteHandler: ErrorHandler = d => c => report(d)(c) def withIncompleteHandler[T](handler: ErrorHandler)(op: => T): T = { val saved = incompleteHandler incompleteHandler = handler @@ -212,7 +212,7 @@ abstract class Reporter extends interfaces.ReporterResult { var warningCount = 0 def hasErrors = errorCount > 0 def hasWarnings = warningCount > 0 - private var errors: List[Error] = Nil + private[this] var errors: List[Error] = Nil def allErrors = errors /** Have errors been reported by this reporter, or in the diff --git a/compiler/src/dotty/tools/dotc/reporting/StoreReporter.scala b/compiler/src/dotty/tools/dotc/reporting/StoreReporter.scala index ac60124ae86e..acb0d573507d 100644 --- a/compiler/src/dotty/tools/dotc/reporting/StoreReporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/StoreReporter.scala @@ -20,7 +20,7 @@ import diagnostic.messages._ */ class StoreReporter(outer: Reporter) extends Reporter { - private var infos: mutable.ListBuffer[MessageContainer] = null + private[this] var infos: mutable.ListBuffer[MessageContainer] = null def reset() = infos = null diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/MessageContainer.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/MessageContainer.scala index 9884fdb1d1c8..c2d94030ca0b 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/MessageContainer.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/MessageContainer.scala @@ -29,9 +29,9 @@ class MessageContainer( val level: Int ) extends Exception with interfaces.Diagnostic { import MessageContainer._ - private var myMsg: String = null - private var myIsNonSensical: Boolean = false - private var myContained: Message = null + private[this] var myMsg: String = null + private[this] var myIsNonSensical: Boolean = false + private[this] var myContained: Message = null override def position: Optional[interfaces.SourcePosition] = if (pos.exists && pos.source.exists) Optional.of(pos) else Optional.empty() diff --git a/compiler/src/dotty/tools/dotc/transform/Bridges.scala b/compiler/src/dotty/tools/dotc/transform/Bridges.scala index 98aca1a98607..08c0d4fcf700 100644 --- a/compiler/src/dotty/tools/dotc/transform/Bridges.scala +++ b/compiler/src/dotty/tools/dotc/transform/Bridges.scala @@ -30,7 +30,7 @@ class Bridges(root: ClassSymbol)(implicit ctx: Context) { //val site = root.thisType - private var toBeRemoved = immutable.Set[Symbol]() + private[this] var toBeRemoved = immutable.Set[Symbol]() private val bridges = mutable.ListBuffer[Tree]() private val bridgesScope = newScope private val bridgeTarget = mutable.HashMap[Symbol, Symbol]() diff --git a/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala b/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala index e2f425d527f8..07cbceb7b2e4 100644 --- a/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala +++ b/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala @@ -46,7 +46,7 @@ class CapturedVars extends MiniPhase with IdentityDenotTransformer { thisTransfo class Transform(captured: collection.Set[Symbol]) extends TreeTransform { def phase = thisTransform - private var myRefInfo: RefInfo = null + private[this] var myRefInfo: RefInfo = null private def refInfo(implicit ctx: Context) = { if (myRefInfo == null) myRefInfo = new RefInfo() myRefInfo diff --git a/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala b/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala index 878b3af95f12..92228b9a8463 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala @@ -45,9 +45,9 @@ class CheckReentrant extends MiniPhaseTransform { thisTransformer => override def phaseName = "checkReentrant" - private var shared: Set[Symbol] = Set() - private var seen: Set[ClassSymbol] = Set() - private var indent: Int = 0 + private[this] var shared: Set[Symbol] = Set() + private[this] var seen: Set[ClassSymbol] = Set() + private[this] var indent: Int = 0 private val sharableAnnot = new CtxLazy(implicit ctx => ctx.requiredClass("dotty.tools.sharable")) diff --git a/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala b/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala index e82be4378059..893e79ce0282 100644 --- a/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala +++ b/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala @@ -31,7 +31,7 @@ class CollectEntryPoints extends MiniPhaseTransform { this } - private var entryPoints: Set[Symbol] = _ + private[this] var entryPoints: Set[Symbol] = _ def getEntryPoints = entryPoints.toList diff --git a/compiler/src/dotty/tools/dotc/transform/CtxLazy.scala b/compiler/src/dotty/tools/dotc/transform/CtxLazy.scala index c0306ca2b1d0..a22d24ebbb17 100644 --- a/compiler/src/dotty/tools/dotc/transform/CtxLazy.scala +++ b/compiler/src/dotty/tools/dotc/transform/CtxLazy.scala @@ -12,8 +12,8 @@ import core.Contexts.Context * the expression intiializing the lazy val depends only on the root context, but not any changes afterwards. */ class CtxLazy[T](expr: Context => T) { - private var myValue: T = _ - private var forced = false + private[this] var myValue: T = _ + private[this] var forced = false def apply()(implicit ctx: Context): T = { if (!forced) { myValue = expr(ctx) diff --git a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala index ad9c87df5eb0..44385845e3ec 100644 --- a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala +++ b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala @@ -40,7 +40,7 @@ class FirstTransform extends MiniPhaseTransform with InfoTransformer with Annota override def phaseName = "firstTransform" - private var addCompanionPhases: List[NeedsCompanions] = _ + private[this] var addCompanionPhases: List[NeedsCompanions] = _ override def changesMembers = true // the phase adds companion objects diff --git a/compiler/src/dotty/tools/dotc/transform/Flatten.scala b/compiler/src/dotty/tools/dotc/transform/Flatten.scala index e2181538a9b0..49261cc5276a 100644 --- a/compiler/src/dotty/tools/dotc/transform/Flatten.scala +++ b/compiler/src/dotty/tools/dotc/transform/Flatten.scala @@ -27,8 +27,8 @@ class Flatten extends MiniPhaseTransform with SymTransformer { thisTransform => else ref } - private var liftedDefs = new mutable.ListBuffer[Tree] - private var liftedDefsQueue = List.empty[mutable.ListBuffer[Tree]] + private[this] var liftedDefs = new mutable.ListBuffer[Tree] + private[this] var liftedDefsQueue = List.empty[mutable.ListBuffer[Tree]] override def prepareForPackageDef(tree: PackageDef)(implicit ctx: Context) = { liftedDefsQueue = liftedDefs :: liftedDefsQueue diff --git a/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala b/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala index c1d29e2babe3..b1f384586a0b 100644 --- a/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala @@ -43,7 +43,7 @@ class InterceptedMethods extends MiniPhaseTransform { override def phaseName: String = "intercepted" - private var primitiveGetClassMethods: Set[Symbol] = _ + private[this] var primitiveGetClassMethods: Set[Symbol] = _ var Any_## : Symbol = _ // cached for performance reason diff --git a/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala b/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala index 63e02c03ce72..23d58c035577 100644 --- a/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala +++ b/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala @@ -109,10 +109,10 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform private val liftedDefs = new HashMap[Symbol, mutable.ListBuffer[Tree]] /** A flag to indicate whether new free variables have been found */ - private var changedFreeVars: Boolean = _ + private[this] var changedFreeVars: Boolean = _ /** A flag to indicate whether lifted owners have changed */ - private var changedLiftedOwner: Boolean = _ + private[this] var changedLiftedOwner: Boolean = _ private val ord: Ordering[Symbol] = Ordering.by((_: Symbol).id) // Dotty deviation: Type annotation needed. TODO: figure out why private def newSymSet = TreeSet.empty[Symbol](ord) diff --git a/compiler/src/dotty/tools/dotc/transform/LinkAll.scala b/compiler/src/dotty/tools/dotc/transform/LinkAll.scala index 108690be0cd3..fe3270cebf44 100644 --- a/compiler/src/dotty/tools/dotc/transform/LinkAll.scala +++ b/compiler/src/dotty/tools/dotc/transform/LinkAll.scala @@ -40,7 +40,7 @@ class LinkAll extends Phase { /** Collects all class denotations that may need to be loaded. */ private class ClassesToLoadAccumulator extends TreeAccumulator[Set[ClassDenotation]] { - private var inParents = false + private[this] var inParents = false override def apply(acc: Set[ClassDenotation], tree: tpd.Tree)(implicit ctx: Context): Set[ClassDenotation] = tree match { case New(tpt) => accum(acc, tpt.tpe.classSymbol) case AppliedTypeTree(tpt, _) if inParents => accum(acc, tpt.symbol) diff --git a/compiler/src/dotty/tools/dotc/transform/Memoize.scala b/compiler/src/dotty/tools/dotc/transform/Memoize.scala index 733791da5a4a..44bb6bd73c88 100644 --- a/compiler/src/dotty/tools/dotc/transform/Memoize.scala +++ b/compiler/src/dotty/tools/dotc/transform/Memoize.scala @@ -26,7 +26,7 @@ import Decorators._ * def x(): T = x * * def x(): T = e - * --> private var x: T = e + * --> private[this] var x: T = e * def x(): T = x * * def x_=(y: T): Unit = () diff --git a/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala b/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala index cbd79d5c50d6..a37d06505d42 100644 --- a/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala +++ b/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala @@ -84,10 +84,10 @@ object OverridingPairs { /** The current entry candidate for overriding */ - private var curEntry = decls.lastEntry + private[this] var curEntry = decls.lastEntry /** The current entry candidate for overridden */ - private var nextEntry = curEntry + private[this] var nextEntry = curEntry /** The current candidate symbol for overriding */ var overriding: Symbol = _ diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala index d2b8e383f197..0d3ec5ac55d5 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -121,7 +121,7 @@ object PatternMatcher { // ------- Plan and test types ------------------------ /** Counter to display plans nicely, for debugging */ - private var nxId = 0 + private[this] var nxId = 0 /** The different kinds of plans */ sealed abstract class Plan { val id = nxId; nxId += 1 } diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala index 122ecd83eb63..6375e4b86aad 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala @@ -45,7 +45,7 @@ class PatternMatcherOld extends MiniPhaseTransform with DenotTransformer { override def phaseName = "patternMatcher" - private var _id = 0 // left for debuging + private[this] var _id = 0 // left for debuging override def transformMatch(tree: Match)(implicit ctx: Context, info: TransformerInfo): Tree = { val translated = new Translator()(ctx).translator.translateMatch(tree) diff --git a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala index 0625242adbc0..1d235a81ae04 100644 --- a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala @@ -93,9 +93,9 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTrans class PostTyperTransformer extends Transformer { - private var inJavaAnnot: Boolean = false + private[this] var inJavaAnnot: Boolean = false - private var noCheckNews: Set[New] = Set() + private[this] var noCheckNews: Set[New] = Set() def withNoCheckNews[T](ts: List[New])(op: => T): T = { val saved = noCheckNews diff --git a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala index 8cba190c0437..e223bff6e992 100644 --- a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala +++ b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala @@ -52,7 +52,7 @@ class SuperAccessors(thisTransformer: DenotTransformer) { * The `invalidEnclClass` field, if different from NoSymbol, * contains the symbol that is not a valid owner. */ - private var invalidEnclClass: Symbol = NoSymbol + private[this] var invalidEnclClass: Symbol = NoSymbol private def withInvalidCurrentClass[A](trans: => A)(implicit ctx: Context): A = { val saved = invalidEnclClass diff --git a/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala b/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala index 9481e8c71fd9..74e3b6821a9d 100644 --- a/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala @@ -39,9 +39,9 @@ import scala.language.postfixOps class SyntheticMethods(thisTransformer: DenotTransformer) { import ast.tpd._ - private var myValueSymbols: List[Symbol] = Nil - private var myCaseSymbols: List[Symbol] = Nil - private var myCaseModuleSymbols: List[Symbol] = Nil + private[this] var myValueSymbols: List[Symbol] = Nil + private[this] var myCaseSymbols: List[Symbol] = Nil + private[this] var myCaseModuleSymbols: List[Symbol] = Nil private def initSymbols(implicit ctx: Context) = if (myValueSymbols.isEmpty) { diff --git a/compiler/src/dotty/tools/dotc/transform/TailRec.scala b/compiler/src/dotty/tools/dotc/transform/TailRec.scala index a99a41921abd..9c23799530c0 100644 --- a/compiler/src/dotty/tools/dotc/transform/TailRec.scala +++ b/compiler/src/dotty/tools/dotc/transform/TailRec.scala @@ -180,7 +180,7 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete private val defaultReason = "it contains a recursive call not in tail position" - private var ctx: TailContext = yesTailContext + private[this] var ctx: TailContext = yesTailContext /** Rewrite this tree to contain no tail recursive calls */ def transform(tree: Tree, nctx: TailContext)(implicit c: Context): Tree = { diff --git a/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala b/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala index badfc0c3d920..b316176259de 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala @@ -1194,7 +1194,7 @@ object TreeTransforms { goOther(tree, info.nx.nxTransOther(cur)) } - private var crashingTree: Tree = EmptyTree + private[this] var crashingTree: Tree = EmptyTree def transform(tree: Tree, info: TransformerInfo, cur: Int)(implicit ctx: Context): Tree = ctx.traceIndented(s"transforming ${tree.show} at ${ctx.phase}", transforms, show = true) { try diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index a1d19d00b964..a0e8b8c6972e 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -535,9 +535,9 @@ trait Applications extends Compatibility { self: Typer with Dynamic => extends Application(methRef, fun.tpe, args, resultType) { type TypedArg = Tree def isVarArg(arg: Trees.Tree[T]): Boolean = untpd.isWildcardStarArg(arg) - private var typedArgBuf = new mutable.ListBuffer[Tree] - private var liftedDefs: mutable.ListBuffer[Tree] = null - private var myNormalizedFun: Tree = fun + private[this] var typedArgBuf = new mutable.ListBuffer[Tree] + private[this] var liftedDefs: mutable.ListBuffer[Tree] = null + private[this] var myNormalizedFun: Tree = fun init() def addArg(arg: Tree, formal: Type): Unit = diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index d330327b5c15..7e16230fc098 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -156,10 +156,10 @@ object Checking { private val locked = mutable.Set[TypeRef]() /** Are cycles allowed within nested refinedInfos of currently checked type? */ - private var nestedCycleOK = false + private[this] var nestedCycleOK = false /** Are cycles allowed within currently checked type? */ - private var cycleOK = false + private[this] var cycleOK = false /** A diagnostic output string that indicates the position of the last * part of a type bounds checked by checkInfo. Possible choices: diff --git a/compiler/src/dotty/tools/dotc/typer/FrontEnd.scala b/compiler/src/dotty/tools/dotc/typer/FrontEnd.scala index 6eff63e2be6f..6cb045853ad1 100644 --- a/compiler/src/dotty/tools/dotc/typer/FrontEnd.scala +++ b/compiler/src/dotty/tools/dotc/typer/FrontEnd.scala @@ -20,7 +20,7 @@ class FrontEnd extends Phase { import ast.tpd /** The contexts for compilation units that are parsed but not yet entered */ - private var remaining: List[Context] = Nil + private[this] var remaining: List[Context] = Nil /** Does a source file ending with `.scala` belong to a compilation unit * that is parsed but not yet entered? diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index cc62d3448d0d..bd1cca03f77e 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -914,7 +914,7 @@ trait Implicits { self: Typer => final class ExplainedImplicitSearch(pt: Type, argument: Tree, pos: Position)(implicit ctx: Context) extends ImplicitSearch(pt, argument, pos) { - private var myFailures = new mutable.ListBuffer[ExplainedSearchFailure] + private[this] var myFailures = new mutable.ListBuffer[ExplainedSearchFailure] private def record(fail: ExplainedSearchFailure) = { myFailures += fail fail diff --git a/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala b/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala index 1870ca360edc..8b06148a7723 100644 --- a/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala +++ b/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala @@ -60,10 +60,10 @@ class ImportInfo(symf: Context => Symbol, val selectors: List[untpd.Tree], /** Does the import clause end with wildcard? */ def isWildcardImport = { ensureInitialized(); myWildcardImport } - private var myExcluded: Set[TermName] = null - private var myMapped: SimpleIdentityMap[TermName, TermName] = null - private var myOriginals: Set[TermName] = null - private var myWildcardImport: Boolean = false + private[this] var myExcluded: Set[TermName] = null + private[this] var myMapped: SimpleIdentityMap[TermName, TermName] = null + private[this] var myOriginals: Set[TermName] = null + private[this] var myWildcardImport: Boolean = false /** Compute info relating to the selector list */ private def ensureInitialized(): Unit = if (myExcluded == null) { diff --git a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala index 295962162840..ae4bee6b8fd0 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala @@ -74,7 +74,7 @@ object Inferencing { typr.println(i"forced instantiation of ${tvar.origin} = $inst") inst } - private var toMaximize: Boolean = false + private[this] var toMaximize: Boolean = false def apply(x: Boolean, tp: Type): Boolean = tp.dealias match { case _: WildcardType | _: ProtoType => false diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 62bd705acc6e..d9d852b63198 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -785,8 +785,8 @@ class Namer { typer: Typer => } class TypeDefCompleter(original: TypeDef)(ictx: Context) extends Completer(original)(ictx) with TypeParamsCompleter { - private var myTypeParams: List[TypeSymbol] = null - private var nestedCtx: Context = null + private[this] var myTypeParams: List[TypeSymbol] = null + private[this] var nestedCtx: Context = null assert(!original.isClassDef) def completerTypeParams(sym: Symbol)(implicit ctx: Context): List[TypeSymbol] = { diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala index fc90eb3385fc..669c702b4466 100644 --- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -174,15 +174,15 @@ object ProtoTypes { */ case class FunProto(args: List[untpd.Tree], resType: Type, typer: Typer)(implicit ctx: Context) extends UncachedGroundType with ApplyingProto { - private var myTypedArgs: List[Tree] = Nil + private[this] var myTypedArgs: List[Tree] = Nil override def resultType(implicit ctx: Context) = resType /** A map in which typed arguments can be stored to be later integrated in `typedArgs`. */ - private var myTypedArg: SimpleIdentityMap[untpd.Tree, Tree] = SimpleIdentityMap.Empty + private[this] var myTypedArg: SimpleIdentityMap[untpd.Tree, Tree] = SimpleIdentityMap.Empty /** A map recording the typer states in which arguments stored in myTypedArg were typed */ - private var evalState: SimpleIdentityMap[untpd.Tree, TyperState] = SimpleIdentityMap.Empty + private[this] var evalState: SimpleIdentityMap[untpd.Tree, TyperState] = SimpleIdentityMap.Empty def isMatchedBy(tp: Type)(implicit ctx: Context) = typer.isApplicable(tp, Nil, typedArgs, resultType) @@ -246,7 +246,7 @@ object ProtoTypes { def typeOfArg(arg: untpd.Tree)(implicit ctx: Context): Type = myTypedArg(arg).tpe - private var myTupled: Type = NoType + private[this] var myTupled: Type = NoType /** The same proto-type but with all arguments combined in a single tuple */ def tupled: FunProto = myTupled match { @@ -261,7 +261,7 @@ object ProtoTypes { def isTupled: Boolean = myTupled.isInstanceOf[FunProto] /** If true, the application of this prototype was canceled. */ - private var toDrop: Boolean = false + private[this] var toDrop: Boolean = false /** Cancel the application of this prototype. This can happen for a nullary * application `f()` if `f` refers to a symbol that exists both in parameterless diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index ac81dfc633d8..bc34551a3739 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -80,14 +80,14 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit * Note: It would be more proper to move importedFromRoot into typedIdent. * We should check that this has no performance degradation, however. */ - private var unimported: Set[Symbol] = Set() + private[this] var unimported: Set[Symbol] = Set() /** Temporary data item for single call to typed ident: * This symbol would be found under Scala2 mode, but is not * in dotty (because dotty conforms to spec section 2 * wrt to package member resolution but scalac doe not). */ - private var foundUnderScala2: Type = NoType + private[this] var foundUnderScala2: Type = NoType def newLikeThis: Typer = new Typer diff --git a/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala b/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala index 7cc81ceafdcf..aec4fe128272 100644 --- a/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala +++ b/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala @@ -25,7 +25,7 @@ class VarianceChecker()(implicit ctx: Context) { import tpd._ private object Validator extends TypeAccumulator[Option[VarianceError]] { - private var base: Symbol = _ + private[this] var base: Symbol = _ /** Is no variance checking needed within definition of `base`? */ def ignoreVarianceIn(base: Symbol): Boolean = ( diff --git a/compiler/src/dotty/tools/dotc/util/HashSet.scala b/compiler/src/dotty/tools/dotc/util/HashSet.scala index 4c6b1703b2ea..4df1568dd2ea 100644 --- a/compiler/src/dotty/tools/dotc/util/HashSet.scala +++ b/compiler/src/dotty/tools/dotc/util/HashSet.scala @@ -3,9 +3,9 @@ package dotty.tools.dotc.util /** A hash set that allows some privileged protected access to its internals */ class HashSet[T >: Null <: AnyRef](powerOfTwoInitialCapacity: Int, loadFactor: Float = 0.25f) extends Set[T] { - private var used: Int = _ - private var limit: Int = _ - private var table: Array[AnyRef] = _ + private[this] var used: Int = _ + private[this] var limit: Int = _ + private[this] var table: Array[AnyRef] = _ protected def isEqual(x: T, y: T): Boolean = x.equals(y) @@ -66,7 +66,7 @@ class HashSet[T >: Null <: AnyRef](powerOfTwoInitialCapacity: Int, loadFactor: F entry.asInstanceOf[T] } - private var rover: Int = -1 + private[this] var rover: Int = -1 /** Add entry `x` to set */ def addEntry(x: T): Unit = { @@ -89,7 +89,7 @@ class HashSet[T >: Null <: AnyRef](powerOfTwoInitialCapacity: Int, loadFactor: F /** The iterator of all elements in the set */ def iterator = new Iterator[T] { - private var i = 0 + private[this] var i = 0 def hasNext: Boolean = { while (i < table.length && (table(i) eq null)) i += 1 i < table.length diff --git a/compiler/src/dotty/tools/dotc/util/SourceFile.scala b/compiler/src/dotty/tools/dotc/util/SourceFile.scala index a9a18f91cbfa..8162543c1c47 100644 --- a/compiler/src/dotty/tools/dotc/util/SourceFile.scala +++ b/compiler/src/dotty/tools/dotc/util/SourceFile.scala @@ -100,7 +100,7 @@ case class SourceFile(file: AbstractFile, content: Array[Char]) extends interfac def lineToOffset(index: Int): Int = lineIndices(index) /** A cache to speed up offsetToLine searches to similar lines */ - private var lastLine = 0 + private[this] var lastLine = 0 /** Convert offset to line in this source file * Lines are numbered from 0 diff --git a/compiler/src/dotty/tools/dotc/util/Stats.scala b/compiler/src/dotty/tools/dotc/util/Stats.scala index bb2f2dff8063..c69796f84896 100644 --- a/compiler/src/dotty/tools/dotc/util/Stats.scala +++ b/compiler/src/dotty/tools/dotc/util/Stats.scala @@ -14,7 +14,7 @@ import collection.mutable var monitored = false - @volatile private var stack: List[String] = Nil + @volatile private[this] var stack: List[String] = Nil val hits = new mutable.HashMap[String, Int] { override def default(key: String): Int = 0 diff --git a/compiler/src/dotty/tools/io/VirtualFile.scala b/compiler/src/dotty/tools/io/VirtualFile.scala index e7af2a778f08..be2c6902cd39 100644 --- a/compiler/src/dotty/tools/io/VirtualFile.scala +++ b/compiler/src/dotty/tools/io/VirtualFile.scala @@ -30,7 +30,7 @@ class VirtualFile(val name: String, override val path: String) extends AbstractF case _ => false } - private var content = Array.emptyByteArray + private[this] var content = Array.emptyByteArray def absolute = this @@ -58,7 +58,7 @@ class VirtualFile(val name: String, override val path: String) extends AbstractF /** @inheritdoc */ override def isVirtual: Boolean = true - // private var _lastModified: Long = 0 + // private[this] var _lastModified: Long = 0 // _lastModified /** Returns the time that this abstract file was last modified. */ diff --git a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala index 2732f969ab31..eab9f54b9abe 100644 --- a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala +++ b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala @@ -62,7 +62,7 @@ trait RunnerOrchestration { def runMain(classPath: String)(implicit summaryReport: SummaryReporting): Status = withRunner(_.runMain(classPath)) - private class Runner(private var process: Process) { + private class Runner(private[this] var process: Process) { private[this] var childStdout: BufferedReader = _ private[this] var childStdin: PrintStream = _ diff --git a/doc-tool/src/dotty/tools/dottydoc/core/ContextDottydoc.scala b/doc-tool/src/dotty/tools/dottydoc/core/ContextDottydoc.scala index 8f463833d373..161e799da7ce 100644 --- a/doc-tool/src/dotty/tools/dottydoc/core/ContextDottydoc.scala +++ b/doc-tool/src/dotty/tools/dottydoc/core/ContextDottydoc.scala @@ -27,7 +27,7 @@ class ContextDottydoc extends ContextDocstrings { def statistics: Map[String, Statistics] = _statistics /** Should perhaps factorize this into caches that get flushed */ - private var _defs: Map[Symbol, Set[Symbol]] = Map.empty + private[this] var _defs: Map[Symbol, Set[Symbol]] = Map.empty def defs(sym: Symbol): Set[Symbol] = _defs.get(sym).getOrElse(Set.empty) def addDef(s: Symbol, d: Symbol): Unit = _defs = (_defs + { diff --git a/library/src/scala/runtime/EnumValues.scala b/library/src/scala/runtime/EnumValues.scala index 6f9d907b314f..64901512cad1 100644 --- a/library/src/scala/runtime/EnumValues.scala +++ b/library/src/scala/runtime/EnumValues.scala @@ -3,8 +3,8 @@ package scala.runtime import scala.collection.immutable.Map class EnumValues[E <: Enum] { - private var myMap: Map[Int, E] = Map() - private var fromNameCache: Map[String, E] = null + private[this] var myMap: Map[Int, E] = Map() + private[this] var fromNameCache: Map[String, E] = null def register(v: E) = { require(!myMap.contains(v.enumTag))