Skip to content

Commit 1702d5e

Browse files
committed
Re-privatisation
1 parent c7d7a4b commit 1702d5e

File tree

7 files changed

+49
-47
lines changed

7 files changed

+49
-47
lines changed

src/reflect/scala/reflect/internal/Types.scala

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,25 @@ trait Types
8585
import definitions._
8686
import TypesStats._
8787

88-
/*TODO private*/ var explainSwitch = false
89-
/*TODO private*/ final val emptySymbolSet = immutable.Set.empty[Symbol]
88+
private var explainSwitch = false
89+
private final val emptySymbolSet = immutable.Set.empty[Symbol]
9090

91-
/*TODO private*/ final val LogPendingSubTypesThreshold = 50
92-
/*TODO private*/ final val LogPendingBaseTypesThreshold = 50
93-
/*TODO private*/ final val LogVolatileThreshold = 50
91+
protected[internal] final val DefaultLogThreshhold = 50
92+
private final val LogPendingBaseTypesThreshold = DefaultLogThreshhold
93+
private final val LogVolatileThreshold = DefaultLogThreshhold
9494

9595
/** A don't care value for the depth parameter in lubs/glbs and related operations. */
96-
/*TODO private*/ final val AnyDepth = -3
96+
protected[internal] final val AnyDepth = -3
9797

9898
/** Decrement depth unless it is a don't care. */
99-
/*TODO private*/ final def decr(depth: Int) = if (depth == AnyDepth) AnyDepth else depth - 1
99+
protected[internal] final def decr(depth: Int) = if (depth == AnyDepth) AnyDepth else depth - 1
100100

101-
/*TODO private*/ final val traceTypeVars = sys.props contains "scalac.debug.tvar"
102-
/*TODO private*/ final val breakCycles = settings.breakCycles.value
101+
private final val traceTypeVars = sys.props contains "scalac.debug.tvar"
102+
private final val breakCycles = settings.breakCycles.value
103103
/** In case anyone wants to turn off type parameter bounds being used
104104
* to seed type constraints.
105105
*/
106-
/*TODO private*/ final val propagateParameterBoundsToTypeVars = sys.props contains "scalac.debug.prop-constraints"
106+
private final val propagateParameterBoundsToTypeVars = sys.props contains "scalac.debug.prop-constraints"
107107

108108
protected val enableTypeVarExperimentals = settings.Xexperimental.value
109109

@@ -247,7 +247,7 @@ trait Types
247247
* type instead of the proxy. This gives buried existentials a
248248
* chance to make peace with the other types. See SI-5330.
249249
*/
250-
/*TODO private*/ def narrowForFindMember(tp: Type): Type = {
250+
private def narrowForFindMember(tp: Type): Type = {
251251
val w = tp.widen
252252
// Only narrow on widened type when we have to -- narrow is expensive unless the target is a singleton type.
253253
if ((tp ne w) && containsExistential(w)) w.narrow
@@ -1684,7 +1684,7 @@ trait Types
16841684
define()
16851685
}
16861686
}
1687-
/*TODO private*/ def defineBaseClassesOfCompoundType(tpe: CompoundType, force: Boolean) {
1687+
private def defineBaseClassesOfCompoundType(tpe: CompoundType, force: Boolean) {
16881688
val period = tpe.baseClassesPeriod
16891689
if (period == currentPeriod) {
16901690
if (force && breakCycles) {
@@ -2006,8 +2006,8 @@ trait Types
20062006
* with synchronized, because they are accessed only from isVolatile, which is called only from
20072007
* Typer.
20082008
*/
2009-
/*TODO private*/ var volatileRecursions: Int = 0
2010-
/*TODO private*/ val pendingVolatiles = new mutable.HashSet[Symbol]
2009+
private var volatileRecursions: Int = 0
2010+
private val pendingVolatiles = new mutable.HashSet[Symbol]
20112011

20122012
class ArgsTypeRef(pre0: Type, sym0: Symbol, args0: List[Type]) extends TypeRef(pre0, sym0, args0) {
20132013
require(args0.nonEmpty, this)
@@ -3405,13 +3405,13 @@ trait Types
34053405
// Creators ---------------------------------------------------------------
34063406

34073407
/** Rebind symbol `sym` to an overriding member in type `pre`. */
3408-
/*TODO private*/ def rebind(pre: Type, sym: Symbol): Symbol = {
3408+
private def rebind(pre: Type, sym: Symbol): Symbol = {
34093409
if (!sym.isOverridableMember || sym.owner == pre.typeSymbol) sym
34103410
else pre.nonPrivateMember(sym.name).suchThat(sym => sym.isType || sym.isStable) orElse sym
34113411
}
34123412

34133413
/** Convert a `super` prefix to a this-type if `sym` is abstract or final. */
3414-
/*TODO private*/ def removeSuper(tp: Type, sym: Symbol): Type = tp match {
3414+
private def removeSuper(tp: Type, sym: Symbol): Type = tp match {
34153415
case SuperType(thistp, _) =>
34163416
if (sym.isEffectivelyFinal || sym.isDeferred) thistp
34173417
else tp
@@ -3660,9 +3660,9 @@ trait Types
36603660

36613661
// Hash consing --------------------------------------------------------------
36623662

3663-
/*TODO private*/ val initialUniquesCapacity = 4096
3664-
/*TODO private*/ var uniques: util.HashSet[Type] = _
3665-
/*TODO private*/ var uniqueRunId = NoRunId
3663+
private val initialUniquesCapacity = 4096
3664+
private var uniques: util.HashSet[Type] = _
3665+
private var uniqueRunId = NoRunId
36663666

36673667
protected def unique[T <: Type](tp: T): T = {
36683668
if (Statistics.canEnable) Statistics.incCounter(rawTypeCount)
@@ -3704,7 +3704,7 @@ trait Types
37043704
def containsExistential(tpe: Type) = tpe exists typeIsExistentiallyBound
37053705
def existentialsInType(tpe: Type) = tpe withFilter typeIsExistentiallyBound map (_.typeSymbol)
37063706

3707-
/*TODO private*/ def isDummyOf(tpe: Type)(targ: Type) = {
3707+
private def isDummyOf(tpe: Type)(targ: Type) = {
37083708
val sym = targ.typeSymbol
37093709
sym.isTypeParameter && sym.owner == tpe.typeSymbol
37103710
}
@@ -3803,16 +3803,16 @@ trait Types
38033803
* as a function over the maximum depth `td` of these types, and
38043804
* the maximum depth `bd` of all types in the base type sequences of these types.
38053805
*/
3806-
/*TODO private*/ def lubDepthAdjust(td: Int, bd: Int): Int =
3806+
private def lubDepthAdjust(td: Int, bd: Int): Int =
38073807
if (settings.XfullLubs.value) bd
38083808
else if (bd <= 3) bd
38093809
else if (bd <= 5) td max (bd - 1)
38103810
else if (bd <= 7) td max (bd - 2)
38113811
else (td - 1) max (bd - 3)
38123812

3813-
/*TODO private*/ def symTypeDepth(syms: List[Symbol]): Int = typeDepth(syms map (_.info))
3814-
/*TODO private*/ def typeDepth(tps: List[Type]): Int = maxDepth(tps)
3815-
/*TODO private*/ def baseTypeSeqDepth(tps: List[Type]): Int = maxBaseTypeSeqDepth(tps)
3813+
private def symTypeDepth(syms: List[Symbol]): Int = typeDepth(syms map (_.info))
3814+
private def typeDepth(tps: List[Type]): Int = maxDepth(tps)
3815+
private def baseTypeSeqDepth(tps: List[Type]): Int = maxBaseTypeSeqDepth(tps)
38163816

38173817
/** Is intersection of given types populated? That is,
38183818
* for all types tp1, tp2 in intersection
@@ -3926,8 +3926,8 @@ trait Types
39263926
*/
39273927
final def hasLength(xs: List[_], len: Int) = xs.lengthCompare(len) == 0
39283928

3929-
/*TODO private*/ var basetypeRecursions: Int = 0
3930-
/*TODO private*/ val pendingBaseTypes = new mutable.HashSet[Type]
3929+
private var basetypeRecursions: Int = 0
3930+
private val pendingBaseTypes = new mutable.HashSet[Type]
39313931

39323932

39333933
/** Does this type have a prefix that begins with a type variable,
@@ -3969,7 +3969,7 @@ trait Types
39693969
|| isValueElseNonValue(tp) // otherwise only value types
39703970
)
39713971

3972-
/*TODO private*/ def isHKTypeRef(tp: Type) = tp match {
3972+
private def isHKTypeRef(tp: Type) = tp match {
39733973
case TypeRef(_, sym, Nil) => tp.isHigherKinded
39743974
case _ => false
39753975
}
@@ -3985,7 +3985,7 @@ trait Types
39853985
*/
39863986
/**** Not used right now, but kept around to document which Types
39873987
* land in which bucket.
3988-
/*TODO private*/ def isInternalTypeNotUsedAsTypeArg(tp: Type): Boolean = tp match {
3988+
private def isInternalTypeNotUsedAsTypeArg(tp: Type): Boolean = tp match {
39893989
case AntiPolyType(pre, targs) => true
39903990
case ClassInfoType(parents, defs, clazz) => true
39913991
case ErasedValueType(tref) => true
@@ -3996,20 +3996,20 @@ trait Types
39963996
case _ => false
39973997
}
39983998
****/
3999-
/*TODO private*/ def isInternalTypeUsedAsTypeArg(tp: Type): Boolean = tp match {
3999+
private def isInternalTypeUsedAsTypeArg(tp: Type): Boolean = tp match {
40004000
case WildcardType => true
40014001
case BoundedWildcardType(_) => true
40024002
case ErrorType => true
40034003
case _: TypeVar => true
40044004
case _ => false
40054005
}
4006-
/*TODO private*/ def isAlwaysValueType(tp: Type) = tp match {
4006+
private def isAlwaysValueType(tp: Type) = tp match {
40074007
case RefinedType(_, _) => true
40084008
case ExistentialType(_, _) => true
40094009
case ConstantType(_) => true
40104010
case _ => false
40114011
}
4012-
/*TODO private*/ def isAlwaysNonValueType(tp: Type) = tp match {
4012+
private def isAlwaysNonValueType(tp: Type) = tp match {
40134013
case OverloadedType(_, _) => true
40144014
case NullaryMethodType(_) => true
40154015
case MethodType(_, _) => true
@@ -4020,7 +4020,7 @@ trait Types
40204020
* can be given: true == value type, false == non-value type. Otherwise,
40214021
* an exception is thrown.
40224022
*/
4023-
/*TODO private*/ def isValueElseNonValue(tp: Type): Boolean = tp match {
4023+
private def isValueElseNonValue(tp: Type): Boolean = tp match {
40244024
case tp if isAlwaysValueType(tp) => true
40254025
case tp if isAlwaysNonValueType(tp) => false
40264026
case AnnotatedType(_, underlying, _) => isValueElseNonValue(underlying)
@@ -4070,7 +4070,7 @@ trait Types
40704070
corresponds3(tps1, tps2, tparams map (_.variance))(isSubArg)
40714071
}
40724072

4073-
/*TODO private*/ def containsNull(sym: Symbol): Boolean =
4073+
protected[internal] def containsNull(sym: Symbol): Boolean =
40744074
sym.isClass && sym != NothingClass &&
40754075
!(sym isNonBottomSubClass AnyValClass) &&
40764076
!(sym isNonBottomSubClass NotNullClass)
@@ -4092,7 +4092,7 @@ trait Types
40924092
/** Does member `sym1` of `tp1` have a stronger type
40934093
* than member `sym2` of `tp2`?
40944094
*/
4095-
/*TODO private*/ def specializesSym(tp1: Type, sym1: Symbol, tp2: Type, sym2: Symbol, depth: Int): Boolean = {
4095+
protected[internal] def specializesSym(tp1: Type, sym1: Symbol, tp2: Type, sym2: Symbol, depth: Int): Boolean = {
40964096
require((sym1 ne NoSymbol) && (sym2 ne NoSymbol), ((tp1, sym1, tp2, sym2, depth)))
40974097
val info1 = tp1.memberInfo(sym1)
40984098
val info2 = tp2.memberInfo(sym2).substThis(tp2.typeSymbol, tp1)
@@ -4226,7 +4226,7 @@ trait Types
42264226
*/
42274227

42284228
/** Are `syms1` and `syms2` parameter lists with pairwise equivalent types? */
4229-
/*TODO private*/ def matchingParams(syms1: List[Symbol], syms2: List[Symbol], syms1isJava: Boolean, syms2isJava: Boolean): Boolean = syms1 match {
4229+
protected[internal] def matchingParams(syms1: List[Symbol], syms2: List[Symbol], syms1isJava: Boolean, syms2isJava: Boolean): Boolean = syms1 match {
42304230
case Nil =>
42314231
syms2.isEmpty
42324232
case sym1 :: rest1 =>
@@ -4432,7 +4432,7 @@ trait Types
44324432
}
44334433

44344434
/** The current indentation string for traces */
4435-
/*TODO private*/ var indent: String = ""
4435+
protected[internal] var indent: String = ""
44364436

44374437
/** Perform operation `p` on arguments `tp1`, `arg2` and print trace of computation. */
44384438
protected def explain[T](op: String, p: (Type, T) => Boolean, tp1: Type, arg2: T): Boolean = {

src/reflect/scala/reflect/internal/types/CommonOwners.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ trait CommonOwners extends api.Types {
1111
/** The most deeply nested owner that contains all the symbols
1212
* of thistype or prefixless typerefs/singletype occurrences in given type.
1313
*/
14-
/*TODO private*/ def commonOwner(t: Type): Symbol = commonOwner(t :: Nil)
14+
protected[internal] def commonOwner(t: Type): Symbol = commonOwner(t :: Nil)
1515

1616
/** The most deeply nested owner that contains all the symbols
1717
* of thistype or prefixless typerefs/singletype occurrences in given list
1818
* of types.
1919
*/
20-
/*TODO private*/ def commonOwner(tps: List[Type]): Symbol = {
20+
protected[internal] def commonOwner(tps: List[Type]): Symbol = {
2121
if (tps.isEmpty) NoSymbol
2222
else {
2323
commonOwnerMap.clear()
@@ -49,5 +49,5 @@ trait CommonOwners extends api.Types {
4949
}
5050
}
5151

52-
/*TODO private*/ lazy val commonOwnerMapObj = new CommonOwnerMap
52+
private lazy val commonOwnerMapObj = new CommonOwnerMap
5353
}

src/reflect/scala/reflect/internal/types/GlbLubs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ trait GlbLubs extends api.Types {
282282
}
283283

284284
/** The least upper bound wrt <:< of a list of types */
285-
/*TODO private*/ def lub(ts: List[Type], depth: Int): Type = {
285+
protected[internal] def lub(ts: List[Type], depth: Int): Type = {
286286
def lub0(ts0: List[Type]): Type = elimSub(ts0, depth) match {
287287
case List() => NothingClass.tpe
288288
case List(t) => t
@@ -434,7 +434,7 @@ trait GlbLubs extends api.Types {
434434
}
435435
}
436436

437-
/*TODO private*/ def glb(ts: List[Type], depth: Int): Type = elimSuper(ts) match {
437+
protected[internal] def glb(ts: List[Type], depth: Int): Type = elimSuper(ts) match {
438438
case List() => AnyClass.tpe
439439
case List(t) => t
440440
case ts0 => glbNorm(ts0, depth)

src/reflect/scala/reflect/internal/types/TypeComparers.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ trait TypeComparers extends api.Types {
1919
import definitions._
2020
import TypesStats._
2121

22+
private final val LogPendingSubTypesThreshold = DefaultLogThreshhold
23+
2224
private val pendingSubTypes = new mutable.HashSet[SubTypePair]
2325

2426
class SubTypePair(val tp1: Type, val tp2: Type) {
@@ -117,7 +119,7 @@ trait TypeComparers extends api.Types {
117119
// if (subsametypeRecursions == 0) undoLog.clear()
118120
}
119121

120-
/*TODO private*/ def isSameType1(tp1: Type, tp2: Type): Boolean = {
122+
private def isSameType1(tp1: Type, tp2: Type): Boolean = {
121123
if ((tp1 eq tp2) ||
122124
(tp1 eq ErrorType) || (tp1 eq WildcardType) ||
123125
(tp2 eq ErrorType) || (tp2 eq WildcardType))
@@ -394,7 +396,7 @@ trait TypeComparers extends api.Types {
394396
}))
395397

396398
/** Does type `tp1` conform to `tp2`? */
397-
/*TODO private*/ def isSubType2(tp1: Type, tp2: Type, depth: Int): Boolean = {
399+
private def isSubType2(tp1: Type, tp2: Type, depth: Int): Boolean = {
398400
if ((tp1 eq tp2) || isErrorOrWildcard(tp1) || isErrorOrWildcard(tp2)) return true
399401
if ((tp1 eq NoType) || (tp2 eq NoType)) return false
400402
if (tp1 eq NoPrefix) return (tp2 eq NoPrefix) || tp2.typeSymbol.isPackageClass // !! I do not see how the "isPackageClass" would be warranted by the spec

src/reflect/scala/reflect/internal/types/TypeConstraints.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ trait TypeConstraints extends api.Types {
9797
/** @PP: Unable to see why these apparently constant types should need vals
9898
* in every TypeConstraint, I lifted them out.
9999
*/
100-
/*TODO private*/ lazy val numericLoBound = IntClass.tpe
101-
/*TODO private*/ lazy val numericHiBound = intersectionType(List(ByteClass.tpe, CharClass.tpe), ScalaPackageClass)
100+
private lazy val numericLoBound = IntClass.tpe
101+
private lazy val numericHiBound = intersectionType(List(ByteClass.tpe, CharClass.tpe), ScalaPackageClass)
102102

103103
/** A class expressing upper and lower bounds constraints of type variables,
104104
* as well as their instantiations.

src/reflect/scala/reflect/internal/types/TypeMaps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ trait TypeMaps extends api.Types {
441441
*/
442442
def isPossiblePrefix(clazz: Symbol) = clazz.isClass && !clazz.isPackageClass
443443

444-
/*TODO private*/ def skipPrefixOf(pre: Type, clazz: Symbol) = (
444+
protected[internal] def skipPrefixOf(pre: Type, clazz: Symbol) = (
445445
(pre eq NoType) || (pre eq NoPrefix) || !isPossiblePrefix(clazz)
446446
)
447447

src/reflect/scala/reflect/internal/types/TypeToStrings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait TypeToStrings extends api.Types {
2121
*/
2222
final val maxTostringRecursions = 50
2323

24-
/*TODO private*/ var tostringRecursions = 0
24+
private var tostringRecursions = 0
2525

2626
protected def typeToString(tpe: Type): String =
2727
if (tostringRecursions >= maxTostringRecursions) {

0 commit comments

Comments
 (0)