Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes #4490 and #4467.

  • Loading branch information...
commit 60c8697f0c39f71c7e735ad02f483cd8779c3567 1 parent 8e10b05
@kzys kzys authored
Showing with 1,033 additions and 1,092 deletions.
  1. +1 −1  src/build/genprod.scala
  2. +8 −8 src/compiler/scala/reflect/internal/BaseTypeSeqs.scala
  3. +3 −3 src/compiler/scala/reflect/internal/NameManglers.scala
  4. +34 −60 src/compiler/scala/reflect/internal/Names.scala
  5. +11 −11 src/compiler/scala/reflect/internal/SymbolTable.scala
  6. +49 −49 src/compiler/scala/reflect/internal/Symbols.scala
  7. +3 −3 src/compiler/scala/reflect/internal/TreeGen.scala
  8. +3 −3 src/compiler/scala/reflect/internal/TreeInfo.scala
  9. +13 −13 src/compiler/scala/reflect/internal/Trees.scala
  10. +151 −175 src/compiler/scala/reflect/internal/Types.scala
  11. +1 −1  src/compiler/scala/tools/nsc/ast/DocComments.scala
  12. +3 −3 src/compiler/scala/tools/nsc/ast/TreeGen.scala
  13. +88 −88 src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
  14. +2 −2 src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
  15. +2 −2 src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
  16. +3 −3 src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
  17. +5 −5 src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
  18. +3 −3 src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
  19. +1 −1  src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala
  20. +3 −3 src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
  21. +1 −1  src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
  22. +1 −1  src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
  23. +1 −1  src/compiler/scala/tools/nsc/interactive/BuildManager.scala
  24. +2 −2 src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
  25. +1 −1  src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
  26. +1 −1  src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala
  27. +1 −1  src/compiler/scala/tools/nsc/io/AbstractFile.scala
  28. +3 −3 src/compiler/scala/tools/nsc/io/Pickler.scala
  29. +3 −3 src/compiler/scala/tools/nsc/javac/JavaParsers.scala
  30. +3 −3 src/compiler/scala/tools/nsc/matching/Matrix.scala
  31. +1 −1  src/compiler/scala/tools/nsc/matching/PatternBindings.scala
  32. +2 −2 src/compiler/scala/tools/nsc/settings/MutableSettings.scala
  33. +2 −2 src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
  34. +2 −2 src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
  35. +1 −1  src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala
  36. +2 −2 src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
  37. +3 −3 src/compiler/scala/tools/nsc/transform/Constructors.scala
  38. +3 −3 src/compiler/scala/tools/nsc/transform/Erasure.scala
  39. +8 −8 src/compiler/scala/tools/nsc/transform/LambdaLift.scala
  40. +1 −1  src/compiler/scala/tools/nsc/transform/LazyVals.scala
  41. +9 −9 src/compiler/scala/tools/nsc/transform/Mixin.scala
  42. +7 −7 src/compiler/scala/tools/nsc/transform/SampleTransform.scala
  43. +18 −18 src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
  44. +5 −5 src/compiler/scala/tools/nsc/transform/UnCurry.scala
  45. +1 −1  src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
  46. +7 −7 src/compiler/scala/tools/nsc/typechecker/Contexts.scala
  47. +9 −9 src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala
  48. +1 −1  src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
  49. +1 −1  src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
  50. +7 −7 src/compiler/scala/tools/nsc/typechecker/Implicits.scala
  51. +20 −20 src/compiler/scala/tools/nsc/typechecker/Infer.scala
  52. +6 −6 src/compiler/scala/tools/nsc/typechecker/Namers.scala
  53. +5 −5 src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
  54. +6 −6 src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
  55. +2 −2 src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
  56. +26 −26 src/compiler/scala/tools/nsc/typechecker/Typers.scala
  57. +7 −7 src/compiler/scala/tools/nsc/typechecker/Variances.scala
  58. +4 −4 src/compiler/scala/tools/nsc/util/DocStrings.scala
  59. +2 −2 src/compiler/scala/tools/nsc/util/Position.scala
  60. +1 −1  src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
  61. +1 −1  src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala
  62. +14 −14 src/library/scala/Array.scala
  63. +3 −2 src/library/scala/DelayedInit.scala
  64. +35 −35 src/library/scala/Math.scala
  65. +7 −6 src/library/scala/collection/IterableLike.scala
  66. +38 −35 src/library/scala/collection/Iterator.scala
  67. +1 −1  src/library/scala/collection/MapLike.scala
  68. +2 −2 src/library/scala/collection/SeqLike.scala
  69. +7 −9 src/library/scala/collection/TraversableOnce.scala
  70. +1 −1  src/library/scala/collection/TraversableView.scala
  71. +1 −1  src/library/scala/collection/generic/GenericCompanion.scala
  72. +21 −21 src/library/scala/collection/immutable/List.scala
  73. +1 −1  src/library/scala/collection/immutable/Map.scala
  74. +13 −13 src/library/scala/collection/immutable/PagedSeq.scala
  75. +4 −4 src/library/scala/collection/immutable/RedBlack.scala
  76. +1 −1  src/library/scala/collection/immutable/Set.scala
  77. +3 −3 src/library/scala/collection/immutable/Stream.scala
  78. +2 −2 src/library/scala/collection/immutable/StringLike.scala
  79. +4 −4 src/library/scala/collection/mutable/BufferLike.scala
  80. +1 −1  src/library/scala/collection/mutable/BufferProxy.scala
  81. +1 −1  src/library/scala/collection/mutable/ImmutableMapAdaptor.scala
  82. +1 −1  src/library/scala/collection/mutable/ImmutableSetAdaptor.scala
  83. +1 −1  src/library/scala/collection/mutable/IndexedSeqView.scala
  84. +1 −1  src/library/scala/collection/mutable/MapLike.scala
  85. +1 −1  src/library/scala/collection/mutable/MutableList.scala
  86. +4 −4 src/library/scala/collection/mutable/PriorityQueue.scala
  87. +2 −2 src/library/scala/collection/mutable/Publisher.scala
  88. +3 −3 src/library/scala/collection/mutable/StringBuilder.scala
  89. +2 −2 src/library/scala/concurrent/ops.scala
  90. +1 −1  src/library/scala/math/BigInt.scala
  91. +9 −9 src/library/scala/reflect/ClassManifest.scala
  92. +7 −7 src/library/scala/reflect/Manifest.scala
  93. +3 −3 src/library/scala/reflect/generic/Flags.scala
  94. +1 −1  src/library/scala/reflect/generic/PickleFormat.scala
  95. +1 −1  src/library/scala/reflect/generic/StdNames.scala
  96. +1 −1  src/library/scala/reflect/generic/Symbols.scala
  97. +1 −1  src/library/scala/reflect/generic/Trees.scala
  98. +1 −1  src/library/scala/reflect/generic/Types.scala
  99. +2 −2 src/library/scala/reflect/generic/UnPickler.scala
  100. +1 −1  src/library/scala/util/control/Breaks.scala
  101. +1 −1  src/library/scala/util/matching/Regex.scala
  102. +40 −40 src/library/scala/util/parsing/ast/Binders.scala
  103. +7 −7 src/library/scala/util/parsing/combinator/ImplicitConversions.scala
  104. +160 −172 src/library/scala/util/parsing/combinator/Parsers.scala
  105. +8 −8 src/library/scala/util/parsing/combinator/RegexParsers.scala
  106. +1 −1  src/library/scala/util/parsing/combinator/lexical/Lexical.scala
  107. +2 −2 src/library/scala/util/parsing/combinator/lexical/Scanners.scala
  108. +5 −5 src/library/scala/util/parsing/combinator/lexical/StdLexical.scala
  109. +1 −1  src/library/scala/util/parsing/combinator/syntactical/StandardTokenParsers.scala
  110. +2 −2 src/library/scala/util/parsing/combinator/syntactical/StdTokenParsers.scala
  111. +1 −1  src/library/scala/util/parsing/combinator/syntactical/TokenParsers.scala
  112. +2 −2 src/library/scala/util/parsing/combinator/testing/Tester.scala
  113. +1 −1  src/library/scala/util/parsing/combinator/token/StdTokens.scala
  114. +2 −2 src/library/scala/util/parsing/combinator/token/Tokens.scala
  115. +3 −3 src/library/scala/util/parsing/input/CharArrayReader.scala
  116. +7 −7 src/library/scala/util/parsing/input/OffsetPosition.scala
  117. +9 −9 src/library/scala/util/parsing/input/Position.scala
  118. +1 −1  src/library/scala/util/parsing/input/Positional.scala
  119. +1 −1  src/library/scala/util/parsing/input/StreamReader.scala
  120. +1 −1  src/msil/ch/epfl/lamp/compiler/msil/emit/ILPrinterVisitor.scala
  121. +1 −1  src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala
View
2  src/build/genprod.scala
@@ -238,7 +238,7 @@ class Function(val i: Int) extends Group("Function") with Arity {
curryComment +
" def curried: %s => R = {\n %s\n }\n".format(
targs mkString " => ", body
- ) + """ @deprecated("Use 'curried' instead", "2.8.0")""" + "\n def curry = curried\n"
+ ) + """ @deprecated("Use `curried` instead", "2.8.0")""" + "\n def curry = curried\n"
}
override def moreMethods = curryMethod + tupleMethod
View
16 src/compiler/scala/reflect/internal/BaseTypeSeqs.scala
@@ -13,8 +13,8 @@ import util.Statistics._
/** A base type sequence (BaseTypeSeq) is an ordered sequence spanning all the base types
* of a type. It characterized by the following two laws:
*
- * (1) Each element of `tp.baseTypeSeq' is a basetype of `tp'
- * (2) For each basetype `bt1' of `tp' there is an element `bt' in `tp.baseTypeSeq' such that
+ * (1) Each element of `tp.baseTypeSeq` is a basetype of `tp`
+ * (2) For each basetype `bt1` of `tp` there is an element `bt` in `tp.baseTypeSeq` such that
*
* bt.typeSymbol = bt1.typeSymbol
* bt <: bt1
@@ -96,16 +96,16 @@ trait BaseTypeSeqs {
new BaseTypeSeq(parents, arr)
}
- /** Compute new base type sequence with `tp' prepended to this sequence */
+ /** Compute new base type sequence with `tp` prepended to this sequence */
def prepend(tp: Type): BaseTypeSeq = copy(tp, 1)
- /** Compute new base type sequence with `tp' replacing the head of this sequence */
+ /** Compute new base type sequence with `tp` replacing the head of this sequence */
def updateHead(tp: Type): BaseTypeSeq = copy(tp, 0)
/** Compute new base type sequence where every element is mapped
- * with function `f'. Lazy types are mapped but not evaluated */
+ * with function `f`. Lazy types are mapped but not evaluated */
def map(f: Type => Type): BaseTypeSeq = {
- // inlined `elems map f' for performance
+ // inlined `elems map f` for performance
val len = length
var arr = new Array[Type](len)
var i = 0
@@ -139,7 +139,7 @@ trait BaseTypeSeqs {
d
}
- /** The maximum depth of type `tp' */
+ /** The maximum depth of type `tp` */
protected def maxDpth(tp: Type): Int = tp match {
case TypeRef(pre, sym, args) =>
max(maxDpth(pre), maxDpth(args) + 1)
@@ -159,7 +159,7 @@ trait BaseTypeSeqs {
1
}
- /** The maximum depth of all types `tps' */
+ /** The maximum depth of all types `tps` */
private def maxDpth(tps: Seq[Type]): Int = {
var d = 0
for (tp <- tps) d = max(d, maxDpth(tp))
View
6 src/compiler/scala/reflect/internal/NameManglers.scala
@@ -94,13 +94,13 @@ trait NameManglers {
name.endChar == '=' && name.startChar != '=' && isOperatorPart(name.startChar)
}
- /** The expanded setter name of `name' relative to this class `base`
+ /** The expanded setter name of `name` relative to this class `base`
*/
def expandedSetterName(name: TermName, base: Symbol): TermName =
expandedName(name, base, separator = TRAIT_SETTER_SEPARATOR_STRING)
- /** If `name' is an expandedName name, the original name.
- * Otherwise `name' itself.
+ /** If `name` is an expandedName name, the original name.
+ * Otherwise `name` itself.
*/
def originalName(name: Name): Name = {
var i = name.length
View
94 src/compiler/scala/reflect/internal/Names.scala
@@ -25,21 +25,17 @@ trait Names /*extends reflect.generic.Names*/ {
final val nameDebug = false
- /** memory to store all names sequentially
- */
+ /** Memory to store all names sequentially. */
var chrs: Array[Char] = new Array[Char](NAME_SIZE)
private var nc = 0
- /** hashtable for finding term names quickly
- */
+ /** Hashtable for finding term names quickly. */
private val termHashtable = new Array[TermName](HASH_SIZE)
- /** hashtable for finding type names quickly
- */
+ /** Hashtable for finding type names quickly. */
private val typeHashtable = new Array[TypeName](HASH_SIZE)
- /** the hashcode of a name
- */
+ /** The hashcode of a name. */
private def hashValue(cs: Array[Char], offset: Int, len: Int): Int =
if (len > 0)
(len * (41 * 41 * 41) +
@@ -58,8 +54,7 @@ trait Names /*extends reflect.generic.Names*/ {
i == len
}
- /** enter characters into chrs array
- */
+ /** Enter characters into chrs array. */
private def enterChars(cs: Array[Char], offset: Int, len: Int) {
var i = 0
while (i < len) {
@@ -75,8 +70,7 @@ trait Names /*extends reflect.generic.Names*/ {
else nc = nc + len
}
- /** Create a term name from the characters in cs[offset..offset+len-1].
- */
+ /** Create a term name from the characters in cs[offset..offset+len-1]. */
def newTermName(cs: Array[Char], offset: Int, len: Int): TermName = {
val h = hashValue(cs, offset, len) & HASH_MASK
var n = termHashtable(h)
@@ -89,30 +83,25 @@ trait Names /*extends reflect.generic.Names*/ {
n
}
- /** create a term name from string
- */
+ /** Create a term name from string. */
def newTermName(s: String): TermName =
newTermName(s.toCharArray(), 0, s.length())
- /** Create a term name from the UTF8 encoded bytes in bs[offset..offset+len-1].
- */
+ /** Create a term name from the UTF8 encoded bytes in bs[offset..offset+len-1]. */
def newTermName(bs: Array[Byte], offset: Int, len: Int): TermName = {
val chars = Codec fromUTF8 bs.slice(offset, offset + len)
newTermName(chars, 0, chars.length)
}
- /** Create a type name from the characters in cs[offset..offset+len-1].
- */
+ /** Create a type name from the characters in cs[offset..offset+len-1]. */
def newTypeName(cs: Array[Char], offset: Int, len: Int): TypeName =
newTermName(cs, offset, len).toTypeName
- /** Create a type name from string
- */
+ /** Create a type name from string. */
def newTypeName(s: String): TypeName =
newTermName(s).toTypeName
- /** Create a type name from the UTF8 encoded bytes in bs[offset..offset+len-1].
- */
+ /** Create a type name from the UTF8 encoded bytes in bs[offset..offset+len-1]. */
def newTypeName(bs: Array[Byte], offset: Int, len: Int): TypeName =
newTermName(bs, offset, len).toTypeName
@@ -124,8 +113,7 @@ trait Names /*extends reflect.generic.Names*/ {
def nameChars: Array[Char] = chrs
@deprecated("", "2.9.0") def view(s: String): TermName = newTermName(s)
- /** An implicit conversion from names to term names
- */
+ /** An implicit conversion from names to term names. */
implicit def promoteTermNamesAsNecessary(name: Name): TermName = mkTermName(name)
@@ -136,12 +124,10 @@ trait Names /*extends reflect.generic.Names*/ {
/** Index into name table */
def start: Int = index
- /** next name in the same hash bucket
- */
+ /** The next name in the same hash bucket. */
def next: Name
- /** return the length of this name
- */
+ /** The length of this name. */
final def length: Int = len
final def isEmpty = length == 0
final def nonEmpty = !isEmpty
@@ -153,26 +139,23 @@ trait Names /*extends reflect.generic.Names*/ {
def companionName: Name
def bothNames: List[Name] = List(toTermName, toTypeName)
- /** Copy bytes of this name to buffer cs, starting at position `offset`.
- */
+ /** Copy bytes of this name to buffer cs, starting at position `offset`. */
final def copyChars(cs: Array[Char], offset: Int) =
compat.Platform.arraycopy(chrs, index, cs, offset, len)
- /** return the ascii representation of this name
- */
+ /** @return the ascii representation of this name */
final def toChars: Array[Char] = {
val cs = new Array[Char](len)
copyChars(cs, 0)
cs
}
- /** return the string representation of this name
- */
+ /** @return the string representation of this name */
final override def toString(): String = new String(chrs, index, len)
def debugString() = NameTransformer.decode(toString) + (if (isTypeName) "!" else "")
/** Write to UTF8 representation of this name to given character array.
- * Start copying to index `to'. Return index of next free byte in array.
+ * Start copying to index `to`. Return index of next free byte in array.
* Array must have enough remaining space for all bytes
* (i.e. maximally 3*length bytes).
*/
@@ -182,8 +165,7 @@ trait Names /*extends reflect.generic.Names*/ {
offset + bytes.length
}
- /** return the hash value of this name
- */
+ /** @return the hash value of this name */
final override def hashCode(): Int = index
// Presently disabled.
@@ -209,17 +191,16 @@ trait Names /*extends reflect.generic.Names*/ {
false
}
- /** return the i'th Char of this name
- */
+ /** @return the i'th Char of this name */
final def apply(i: Int): Char = chrs(index + i)
- /** return the index of first occurrence of char c in this name, length if not found */
+ /** @return the index of first occurrence of char c in this name, length if not found */
final def pos(c: Char): Int = pos(c, 0)
- /** return the index of first occurrence of char c in this name, length if not found */
+ /** @return the index of first occurrence of char c in this name, length if not found */
final def pos(s: String): Int = pos(s, 0)
- /** return the index of the first occurrence of character c in
+ /** Returns the index of the first occurrence of character c in
* this name from start, length if not found.
*
* @param c the character
@@ -232,7 +213,7 @@ trait Names /*extends reflect.generic.Names*/ {
i
}
- /** return the index of the first occurrence of nonempty string s
+ /** Returns the index of the first occurrence of nonempty string s
* in this name from start, length if not found.
*
* @param s the string
@@ -252,7 +233,7 @@ trait Names /*extends reflect.generic.Names*/ {
len
}
- /** return the index of last occurrence of char c in this
+ /** Returns the index of last occurrence of char c in this
* name, -1 if not found.
*
* @param c the character
@@ -262,7 +243,7 @@ trait Names /*extends reflect.generic.Names*/ {
final def lastPos(s: String): Int = lastPos(s, len - s.length)
- /** return the index of the last occurrence of char c in this
+ /** Returns the index of the last occurrence of char c in this
* name from start, -1 if not found.
*
* @param c the character
@@ -275,7 +256,7 @@ trait Names /*extends reflect.generic.Names*/ {
i
}
- /** return the index of the last occurrence of string s in this
+ /** Returns the index of the last occurrence of string s in this
* name from start, -1 if not found.
*
* @param s the string
@@ -295,12 +276,10 @@ trait Names /*extends reflect.generic.Names*/ {
-s.length()
}
- /** does this name start with prefix?
- */
+ /** Does this name start with prefix? */
final def startsWith(prefix: Name): Boolean = startsWith(prefix, 0)
- /** does this name start with prefix at given start index?
- */
+ /** Does this name start with prefix at given start index? */
final def startsWith(prefix: Name, start: Int): Boolean = {
var i = 0
while (i < prefix.length && start + i < len &&
@@ -309,12 +288,10 @@ trait Names /*extends reflect.generic.Names*/ {
i == prefix.length
}
- /** does this name end with suffix?
- */
+ /** Does this name end with suffix? */
final def endsWith(suffix: Name): Boolean = endsWith(suffix, len)
- /** does this name end with suffix just before given end index?
- */
+ /** Does this name end with suffix just before given end index? */
final def endsWith(suffix: Name, end: Int): Boolean = {
var i = 1
while (i <= suffix.length && i <= end &&
@@ -347,8 +324,7 @@ trait Names /*extends reflect.generic.Names*/ {
def lastIndexOf(ch: Char) = toChars lastIndexOf ch
- /** Return the subname with characters from start to end-1.
- */
+ /** Return the subname with characters from start to end-1. */
def subName(from: Int, to: Int): Name
/** Replace all occurrences of `from` by `to` in
@@ -365,8 +341,7 @@ trait Names /*extends reflect.generic.Names*/ {
newTermName(cs, 0, len)
}
- /** Replace operator symbols by corresponding $op_name.
- */
+ /** Replace operator symbols by corresponding $op_name. */
def encode: Name = {
val str = toString()
val res = NameTransformer.encode(str)
@@ -378,8 +353,7 @@ trait Names /*extends reflect.generic.Names*/ {
def append(suffix: String): Name
def append(suffix: Name): Name
- /** Replace $op_name by corresponding operator symbol.
- */
+ /** Replace $op_name by corresponding operator symbol. */
def decode: String = (
NameTransformer.decode(toString()) +
(if (nameDebug && isTypeName) "!" else ""))//debug
View
22 src/compiler/scala/reflect/internal/SymbolTable.scala
@@ -31,10 +31,10 @@ abstract class SymbolTable extends /*reflect.generic.Universe
def abort(msg: String): Nothing = throw new Error(msg)
def abort(): Nothing = throw new Error()
- /** Are we compiling for Java SE ? */
+ /** Are we compiling for Java SE? */
// def forJVM: Boolean
- /** Are we compiling for .NET ? */
+ /** Are we compiling for .NET? */
def forMSIL: Boolean = false
/** A period is an ordinal number for a phase in a run.
@@ -63,28 +63,28 @@ abstract class SymbolTable extends /*reflect.generic.Universe
/** The current compiler run identifier. */
def currentRunId: RunId
- /** The run identifier of the given period */
+ /** The run identifier of the given period. */
final def runId(period: Period): RunId = period >> 8
- /** The phase identifier of the given period */
+ /** The phase identifier of the given period. */
final def phaseId(period: Period): Phase#Id = period & 0xFF
- /** The period at the start of run that includes `period' */
+ /** The period at the start of run that includes `period`. */
final def startRun(period: Period): Period = period & 0xFFFFFF00
- /** The current period */
+ /** The current period. */
final def currentPeriod: Period = {
//assert(per == (currentRunId << 8) + phase.id)
per
}
- /** The phase associated with given period */
+ /** The phase associated with given period. */
final def phaseOf(period: Period): Phase = phaseWithId(phaseId(period))
final def period(rid: RunId, pid: Phase#Id): Period =
(currentRunId << 8) + pid
- /** Perform given operation at given phase */
+ /** Perform given operation at given phase. */
final def atPhase[T](ph: Phase)(op: => T): T = {
val current = phase
phase = ph
@@ -113,18 +113,18 @@ abstract class SymbolTable extends /*reflect.generic.Universe
}
}
- /** Break into repl debugger if assertion is true */
+ /** Break into repl debugger if assertion is true. */
// def breakIf(assertion: => Boolean, args: Any*): Unit =
// if (assertion)
// ILoop.break(args.toList)
- /** The set of all installed infotransformers */
+ /** The set of all installed infotransformers. */
var infoTransformers = new InfoTransformer {
val pid = NoPhase.id
val changesBaseClasses = true
def transform(sym: Symbol, tpe: Type): Type = tpe
}
- /** The phase which has given index as identifier */
+ /** The phase which has given index as identifier. */
val phaseWithId: Array[Phase]
}
View
98 src/compiler/scala/reflect/internal/Symbols.scala
@@ -184,10 +184,10 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
final def newSyntheticValueParam(argtype: Type): Symbol =
newSyntheticValueParams(List(argtype)).head
- /** Type skolems are type parameters ``seen from the inside''
+ /** Type skolems are type parameters ''seen from the inside''
* Assuming a polymorphic method m[T], its type is a PolyType which has a TypeParameter
- * with name `T' in its typeParams list. While type checking the parameters, result type and
- * body of the method, there's a local copy of `T' which is a TypeSkolem.
+ * with name `T` in its typeParams list. While type checking the parameters, result type and
+ * body of the method, there's a local copy of `T` which is a TypeSkolem.
*/
final def newTypeSkolem: Symbol =
new TypeSkolem(owner, pos, name.toTypeName, this)
@@ -503,7 +503,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
final def isEffectivelyFinal: Boolean = isFinal || isTerm && (
hasFlag(PRIVATE) || isLocal || owner.isClass && owner.hasFlag(FINAL | MODULE))
- /** Is this symbol locally defined? I.e. not accessed from outside `this' instance */
+ /** Is this symbol locally defined? I.e. not accessed from outside `this` instance */
final def isLocal: Boolean = owner.isTerm
/** Is this symbol a constant? */
@@ -533,14 +533,13 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
(isClass || isType || isModule) && info.normalize/*.underlying*/.isStructuralRefinement
- /** Is this symbol a member of class `clazz'
- */
+ /** Is this symbol a member of class `clazz`? */
def isMemberOf(clazz: Symbol) =
clazz.info.member(name).alternatives contains this
- /** A a member of class `base' is incomplete if
+ /** A a member of class `base` is incomplete if
* (1) it is declared deferred or
- * (2) it is abstract override and its super symbol in `base' is
+ * (2) it is abstract override and its super symbol in `base` is
* nonexistent or incomplete.
*
* @param base ...
@@ -1100,7 +1099,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
/** A total ordering between symbols that refines the class
* inheritance graph (i.e. subclass.isLess(superclass) always holds).
- * the ordering is given by: (_.isType, -_.baseTypeSeq.length) for type symbols, followed by `id'.
+ * the ordering is given by: (_.isType, -_.baseTypeSeq.length) for type symbols, followed by `id`.
*/
final def isLess(that: Symbol): Boolean = {
def baseTypeSeqLength(sym: Symbol) =
@@ -1163,11 +1162,11 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
// ------ cloneing -------------------------------------------------------------------
- /** A clone of this symbol */
+ /** A clone of this symbol. */
final def cloneSymbol: Symbol =
cloneSymbol(owner)
- /** A clone of this symbol, but with given owner */
+ /** A clone of this symbol, but with given owner. */
final def cloneSymbol(owner: Symbol): Symbol = {
val newSym = cloneSymbolImpl(owner)
newSym.privateWithin = privateWithin
@@ -1175,19 +1174,18 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
.setFlag(this.rawflags).setAnnotations(this.annotations)
}
- /** Internal method to clone a symbol's implementation without flags or type
- */
+ /** Internal method to clone a symbol's implementation without flags or type. */
def cloneSymbolImpl(owner: Symbol): Symbol
// ------ access to related symbols --------------------------------------------------
- /** The next enclosing class */
+ /** The next enclosing class. */
def enclClass: Symbol = if (isClass) this else owner.enclClass
- /** The next enclosing method */
+ /** The next enclosing method. */
def enclMethod: Symbol = if (isSourceMethod) this else owner.enclMethod
- /** The primary constructor of a class */
+ /** The primary constructor of a class. */
def primaryConstructor: Symbol = {
var c = info.decl(
if (isTrait || isImplClass) nme.MIXIN_CONSTRUCTOR
@@ -1202,7 +1200,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
*/
def thisSym: Symbol = this
- /** The type of `this' in a class, or else the type of the symbol itself. */
+ /** The type of `this` in a class, or else the type of the symbol itself. */
def typeOfThis = thisSym.tpe
/** If symbol is a class, the type <code>this.type</code> in this class,
@@ -1251,23 +1249,23 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
/** The symbol accessed by this accessor (getter or setter) function. */
final def accessed: Symbol = accessed(owner.info)
- /** The symbol accessed by this accessor function, but with given owner type */
+ /** The symbol accessed by this accessor function, but with given owner type. */
final def accessed(ownerTp: Type): Symbol = {
assert(hasAccessorFlag)
ownerTp.decl(nme.getterToLocal(if (isSetter) nme.setterToGetter(name) else name))
}
/** The module corresponding to this module class (note that this
- * is not updated when a module is cloned), or NoSymbol if this is not a ModuleClass
+ * is not updated when a module is cloned), or NoSymbol if this is not a ModuleClass.
*/
def sourceModule: Symbol = NoSymbol
- /** The implementation class of a trait */
+ /** The implementation class of a trait. */
final def implClass: Symbol = owner.info.decl(nme.implClassName(name))
- /** The class that is logically an outer class of given `clazz'.
+ /** The class that is logically an outer class of given `clazz`.
* This is the enclosing class, except for classes defined locally to constructors,
- * where it is the outer class of the enclosing class
+ * where it is the outer class of the enclosing class.
*/
final def outerClass: Symbol =
if (owner.isClass) owner
@@ -1275,11 +1273,11 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
else owner.outerClass
/** For a paramaccessor: a superclass paramaccessor for which this symbol
- * is an alias, NoSymbol for all others
+ * is an alias, NoSymbol for all others.
*/
def alias: Symbol = NoSymbol
- /** For a lazy value, its lazy accessor. NoSymbol for all others */
+ /** For a lazy value, its lazy accessor. NoSymbol for all others. */
def lazyAccessor: Symbol = NoSymbol
/** If this is a lazy value, the lazy accessor; otherwise this symbol. */
@@ -1290,7 +1288,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
*/
def outerSource: Symbol = NoSymbol
- /** The superclass of this class */
+ /** The superclass of this class. */
def superClass: Symbol = if (info.parents.isEmpty) NoSymbol else info.parents.head.typeSymbol
/** The directly or indirectly inherited mixins of this class
@@ -1302,8 +1300,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
ancestors takeWhile (sc ne)
}
- /** All directly or indirectly inherited classes.
- */
+ /** All directly or indirectly inherited classes. */
def ancestors: List[Symbol] = info.baseClasses drop 1
/** The package class containing this symbol, or NoSymbol if there
@@ -1346,7 +1343,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
*
* def f() { val x = { def g() = ...; g() } }
*
- * In this case the owner chain of `g' is `x', followed by `f' and
+ * In this case the owner chain of `g` is `x`, followed by `f` and
* `g.logicallyEnclosingMember == f`.
*
* Example 2:
@@ -1356,9 +1353,9 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
* val x = { def g() = ...; g() } }
* }
*
- * In this case the owner chain of `g' is `x', followed by `C' but
- * g.logicallyEnclosingMember is the primary constructor symbol `<init>'
- * (or, for traits: `$init') of `C'.
+ * In this case the owner chain of `g` is `x`, followed by `C` but
+ * g.logicallyEnclosingMember is the primary constructor symbol `<init>`
+ * (or, for traits: `$init`) of `C`.
*
*/
def logicallyEnclosingMember: Symbol =
@@ -1366,14 +1363,13 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
else if (isMethod || isClass) this
else owner.logicallyEnclosingMember
- /** The top-level class containing this symbol */
+ /** The top-level class containing this symbol. */
def toplevelClass: Symbol =
if (owner.isPackageClass) {
if (isClass) this else moduleClass
} else owner.toplevelClass
- /** Is this symbol defined in the same scope and compilation unit as `that' symbol?
- */
+ /** Is this symbol defined in the same scope and compilation unit as `that` symbol? */
def isCoDefinedWith(that: Symbol) = (
(this.rawInfo ne NoType) &&
(this.owner == that.owner) && {
@@ -1513,40 +1509,40 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
ofclazz.info.nonPrivateDecl(name).filter(sym =>
!sym.isTerm || (site.memberType(this) matches site.memberType(sym)))
- /** The non-private member of `site' whose type and name match the type of this symbol
- */
+ /** The non-private member of `site` whose type and name match the type of this symbol. */
final def matchingSymbol(site: Type, admit: Long = 0L): Symbol =
site.nonPrivateMemberAdmitting(name, admit).filter(sym =>
!sym.isTerm || (site.memberType(this) matches site.memberType(sym)))
- /** The symbol overridden by this symbol in given class `ofclazz'.
- * @pre 'ofclazz' is a base class of this symbol's owner.
+ /** The symbol overridden by this symbol in given class `ofclazz`.
+ *
+ * @param ofclazz is a base class of this symbol's owner.
*/
final def overriddenSymbol(ofclazz: Symbol): Symbol =
if (isClassConstructor) NoSymbol else matchingSymbol(ofclazz, owner.thisType)
- /** The symbol overriding this symbol in given subclass `ofclazz'
- * @pre: `ofclazz' is a subclass of this symbol's owner
+ /** The symbol overriding this symbol in given subclass `ofclazz`.
+ *
+ * @param ofclazz is a subclass of this symbol's owner
*/
final def overridingSymbol(ofclazz: Symbol): Symbol =
if (isClassConstructor) NoSymbol else matchingSymbol(ofclazz, ofclazz.thisType)
- /** Returns all symbols overriden by this symbol
- */
+ /** Returns all symbols overriden by this symbol. */
final def allOverriddenSymbols: List[Symbol] =
if (!owner.isClass) Nil
else owner.ancestors map overriddenSymbol filter (_ != NoSymbol)
/** Returns all symbols overridden by this symbol, plus all matching symbols
- * defined in parents of the selftype
+ * defined in parents of the selftype.
*/
final def extendedOverriddenSymbols: List[Symbol] =
if (!owner.isClass) Nil
else owner.thisSym.ancestors map overriddenSymbol filter (_ != NoSymbol)
/** The symbol accessed by a super in the definition of this symbol when
- * seen from class `base'. This symbol is always concrete.
- * pre: `this.owner' is in the base class sequence of `base'.
+ * seen from class `base`. This symbol is always concrete.
+ * pre: `this.owner` is in the base class sequence of `base`.
*/
final def superSymbol(base: Symbol): Symbol = {
var bcs = base.info.baseClasses.dropWhile(owner !=).tail
@@ -1559,7 +1555,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
sym
}
- /** The getter of this value or setter definition in class `base', or NoSymbol if
+ /** The getter of this value or setter definition in class `base`, or NoSymbol if
* none exists.
*/
final def getter(base: Symbol): Symbol = {
@@ -1594,7 +1590,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
* where it was unpacked. Resulttype is AnyRef because trees are not visible here. */
def unpackLocation: AnyRef = null
- /** Remove private modifier from symbol `sym's definition. If `sym' is a
+ /** Remove private modifier from symbol `sym`s definition. If `sym` is a
* term symbol rename it by expanding its name to avoid name clashes
*/
final def makeNotPrivate(base: Symbol) {
@@ -1608,7 +1604,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
}
}
- /** change name by appending $$<fully-qualified-name-of-class `base'>
+ /** change name by appending $$<fully-qualified-name-of-class `base`>
* Do the same for any accessed symbols or setters/getters
*/
def expandName(base: Symbol) {
@@ -1999,12 +1995,16 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
/** Let's say you have a type definition
*
+ * {{{
* type T <: Number
+ * }}}
*
* and tsym is the symbol corresponding to T. Then
*
+ * {{{
* tsym.info = TypeBounds(Nothing, Number)
* tsym.tpe = TypeRef(NoPrefix, T, List())
+ * }}}
*/
override def tpe: Type = {
if (tpeCache eq NoType) throw CyclicReference(this, typeConstructor)
@@ -2077,7 +2077,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable =>
* the type parameter from which the skolem was created. If it got created from
* skolemizeExistential, origin is either null or a Tree. If it is a Tree, it indicates
* where the skolem was introduced (this is important for knowing when to pack it
- * again into ab Existential). origin is `null' only in skolemizeExistentials called
+ * again into ab Existential). origin is `null` only in skolemizeExistentials called
* from <:< or isAsSpecific, because here its value does not matter.
* I elieve the following invariant holds:
*
View
6 src/compiler/scala/reflect/internal/TreeGen.scala
@@ -121,7 +121,7 @@ abstract class TreeGen {
None
}
- /** Cast `tree' to type `pt' */
+ /** Cast `tree` to type `pt` */
def mkCast(tree: Tree, pt: Type): Tree = {
if (settings.debug.value) log("casting " + tree + ":" + tree.tpe + " to " + pt)
assert(!tree.tpe.isInstanceOf[MethodType], tree)
@@ -178,7 +178,7 @@ abstract class TreeGen {
def mkAsInstanceOf(value: Tree, tpe: Type, any: Boolean = true): Tree =
mkTypeApply(value, tpe, (if (any) Any_asInstanceOf else Object_asInstanceOf))
- /** Cast `tree' to 'pt', unless tpe is a subtype of pt, or pt is Unit. */
+ /** Cast `tree` to `pt`, unless tpe is a subtype of pt, or pt is Unit. */
def maybeMkAsInstanceOf(tree: Tree, pt: Type, tpe: Type, beforeRefChecks: Boolean = false): Tree =
if ((pt == UnitClass.tpe) || (tpe <:< pt)) {
log("no need to cast from " + tpe + " to " + pt)
@@ -237,4 +237,4 @@ abstract class TreeGen {
// tree1 OR tree2
def mkOr(tree1: Tree, tree2: Tree): Tree =
Apply(Select(tree1, Boolean_or), List(tree2))
-}
+}
View
6 src/compiler/scala/reflect/internal/TreeInfo.scala
@@ -141,13 +141,13 @@ abstract class TreeInfo {
case _ => false
}
- /** The first constructor definitions in `stats' */
+ /** The first constructor definitions in `stats` */
def firstConstructor(stats: List[Tree]): Tree = stats find {
case x: DefDef => nme.isConstructorName(x.name)
case _ => false
} getOrElse EmptyTree
- /** The arguments to the first constructor in `stats'. */
+ /** The arguments to the first constructor in `stats`. */
def firstConstructorArgs(stats: List[Tree]): List[Tree] = firstConstructor(stats) match {
case DefDef(_, _, _, args :: _, _, _) => args
case _ => Nil
@@ -204,7 +204,7 @@ abstract class TreeInfo {
((first.isLower && first.isLetter) || first == '_') && !reserved(name)
}
- /** Is tree a this node which belongs to `enclClass'? */
+ /** Is tree a this node which belongs to `enclClass`? */
def isSelf(tree: Tree, enclClass: Symbol): Boolean = tree match {
case This(_) => tree.symbol == enclClass
case _ => false
View
26 src/compiler/scala/reflect/internal/Trees.scala
@@ -27,7 +27,7 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
/** @param privateWithin the qualifier for a private (a type name)
* or tpnme.EMPTY, if none is given.
* @param annotations the annotations for the definition.
- * <strong>Note:</strong> the typechecker drops these annotations,
+ * '''Note:''' the typechecker drops these annotations,
* use the AnnotationInfo's (Symbol.annotations) in later phases.
*/
case class Modifiers(flags: Long, privateWithin: Name, annotations: List[Tree], positions: Map[Long, Position]) extends HasFlags {
@@ -132,22 +132,22 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
def isErroneous = (this.tpe ne null) && this.tpe.isErroneous
def isTyped = (this.tpe ne null) && !this.tpe.isErroneous
- /** Apply `f' to each subtree */
+ /** Apply `f` to each subtree */
def foreach(f: Tree => Unit) { new ForeachTreeTraverser(f).traverse(this) }
- /** If 'pf' is defined for a given subtree, call super.traverse(pf(tree)),
+ /** If `pf` is defined for a given subtree, call super.traverse(pf(tree)),
* otherwise super.traverse(tree).
*/
def foreachPartial(pf: PartialFunction[Tree, Tree]) { new ForeachPartialTreeTraverser(pf).traverse(this) }
- /** Find all subtrees matching predicate `p' */
+ /** Find all subtrees matching predicate `p` */
def filter(f: Tree => Boolean): List[Tree] = {
val ft = new FilterTreeTraverser(f)
ft.traverse(this)
ft.hits.toList
}
- /** Returns optionally first tree (in a preorder traversal) which satisfies predicate `p',
+ /** Returns optionally first tree (in a preorder traversal) which satisfies predicate `p`,
* or None if none exists.
*/
def find(p: Tree => Boolean): Option[Tree] = {
@@ -162,7 +162,7 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
}
}
- /** Is there part of this tree which satisfies predicate `p'? */
+ /** Is there part of this tree which satisfies predicate `p`? */
def exists(p: Tree => Boolean): Boolean = !find(p).isEmpty
def equalsStructure(that : Tree) = equalsStructure0(that)(_ eq _)
@@ -491,7 +491,7 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
*/
case class ApplyDynamic(qual: Tree, args: List[Tree])
extends TermTree with SymTree
- // The symbol of an ApplyDynamic is the function symbol of `qual', or NoSymbol, if there is none.
+ // The symbol of an ApplyDynamic is the function symbol of `qual`, or NoSymbol, if there is none.
/** Super reference, qual = corresponding this reference */
case class Super(qual: Tree, mix: TypeName) extends TermTree {
@@ -564,7 +564,7 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
/** A synthetic tree holding an arbitrary type. Not to be confused with
* with TypTree, the trait for trees that are only used for type trees.
* TypeTree's are inserted in several places, but most notably in
- * <code>RefCheck</code>, where the arbitrary type trees are all replaced by
+ * `RefCheck`, where the arbitrary type trees are all replaced by
* TypeTree's. */
case class TypeTree() extends TypTree {
private var orig: Tree = null
@@ -628,9 +628,9 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
* supercall arguments and template body.
*
* @param sym the class symbol
- * @param constrMods the modifiers for the class constructor, i.e. as in `class C private (...)'
+ * @param constrMods the modifiers for the class constructor, i.e. as in `class C private (...)`
* @param vparamss the value parameters -- if they have symbols they
- * should be owned by `sym'
+ * should be owned by `sym`
* @param argss the supercall arguments
* @param body the template statements without primary constructor
* and value parameter fields.
@@ -689,13 +689,13 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
DefDef(sym, rhs(sym.info.paramss))
}
- /** A TypeDef node which defines given `sym' with given tight hand side `rhs'. */
+ /** A TypeDef node which defines given `sym` with given tight hand side `rhs`. */
def TypeDef(sym: Symbol, rhs: Tree): TypeDef =
atPos(sym.pos) {
TypeDef(Modifiers(sym.flags), sym.name.toTypeName, sym.typeParams map TypeDef, rhs) setSymbol sym
}
- /** A TypeDef node which defines abstract type or type parameter for given `sym' */
+ /** A TypeDef node which defines abstract type or type parameter for given `sym` */
def TypeDef(sym: Symbol): TypeDef =
TypeDef(sym, TypeBoundsTree(TypeTree(sym.info.bounds.lo), TypeTree(sym.info.bounds.hi)))
@@ -1561,7 +1561,7 @@ trait Trees /*extends reflect.generic.Trees*/ { self: SymbolTable =>
override def toString() = "TreeSymSubstTraverser/" + substituterString("Symbol", "Symbol", from, to)
}
- /** Substitute symbols in 'from' with symbols in 'to'. Returns a new
+ /** Substitute symbols in `from` with symbols in `to`. Returns a new
* tree using the new symbols and whose Ident and Select nodes are
* name-consistent with the new symbols.
*/
View
326 src/compiler/scala/reflect/internal/Types.scala
@@ -56,7 +56,7 @@ import util.Statistics._
case PolyType(tparams, result) =>
// [tparams]result where result is a (Nullary)MethodType or ClassInfoType
- // The remaining types are not used after phase `typer'.
+ // The remaining types are not used after phase `typer`.
case OverloadedType(pre, tparams, alts) =>
// all alternatives of an overloaded ident
case AntiPolyType(pre, targs) =>
@@ -85,16 +85,16 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
private final val LogPendingBaseTypesThreshold = 50
private final val LogVolatileThreshold = 50
- /** A don't care value for the depth parameter in lubs/glbs and related operations */
+ /** A don't care value for the depth parameter in lubs/glbs and related operations. */
private final val AnyDepth = -3
- /** Decrement depth unless it is a don't care */
+ /** Decrement depth unless it is a don't care. */
private final def decr(depth: Int) = if (depth == AnyDepth) AnyDepth else depth - 1
private final val printLubs = false
/** The current skolemization level, needed for the algorithms
- * in isSameType, isSubType that do constraint solving under a prefix
+ * in isSameType, isSubType that do constraint solving under a prefix.
*/
var skolemizationLevel = 0
@@ -105,8 +105,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
private type UndoLog = List[(TypeVar, TypeConstraint)]
private[scala] var log: UndoLog = List()
- /** Undo all changes to constraints to type variables upto `limit'
- */
+ /** Undo all changes to constraints to type variables upto `limit`. */
private def undoTo(limit: UndoLog) {
while ((log ne limit) && log.nonEmpty) {
val (tv, constr) = log.head
@@ -158,7 +157,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
//import gen._
- /** A proxy for a type (identified by field `underlying') that forwards most
+ /** A proxy for a type (identified by field `underlying`) that forwards most
* operations to it (for exceptions, see WrappingProxy, which forwards even more operations).
* every operation that is overridden for some kind of types should be forwarded.
*/
@@ -199,7 +198,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
override def baseClasses = underlying.baseClasses
}
- /** A proxy for a type (identified by field `underlying') that forwards most
+ /** A proxy for a type (identified by field `underlying`) that forwards most
* operations to it. Every operation that is overridden for some kind of types is
* forwarded here. Some operations are rewrapped again.
*/
@@ -257,21 +256,21 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
*/
def isVolatile: Boolean = false
- /** Is this type guaranteed not to have `null' as a value? */
+ /** Is this type guaranteed not to have `null` as a value? */
def isNotNull: Boolean = false
- /** Is this type a structural refinement type (it 'refines' members that have not been inherited) */
+ /** Is this type a structural refinement type (it ''refines'' members that have not been inherited) */
def isStructuralRefinement: Boolean = false
/** Does this type depend immediately on an enclosing method parameter?
- * i.e., is it a singleton type whose termSymbol refers to an argument of the symbol's owner (which is a method)
+ * I.e., is it a singleton type whose termSymbol refers to an argument of the symbol's owner (which is a method)?
*/
def isImmediatelyDependent: Boolean = false
/** Does this depend on an enclosing method parameter? */
def isDependent: Boolean = IsDependentCollector.collect(this)
- /** True for WildcardType or BoundedWildcardType */
+ /** True for WildcardType or BoundedWildcardType. */
def isWildcard = false
/** Is this type produced as a repair for an error? */
@@ -290,11 +289,10 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
def isFinalType =
typeSymbol.isFinal && (typeSymbol.typeParams forall (_.variance == 0))
- /** Is this type completed (i.e. not a lazy type)?
- */
+ /** Is this type completed (i.e. not a lazy type)? */
def isComplete: Boolean = true
- /** If this is a lazy type, assign a new type to `sym'. */
+ /** If this is a lazy type, assign a new type to `sym`. */
def complete(sym: Symbol) {}
/** The term symbol associated with the type
@@ -307,20 +305,17 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
*/
def typeSymbol: Symbol = NoSymbol
- /** The term symbol *directly* associated with the type
- */
+ /** The term symbol ''directly'' associated with the type. */
def termSymbolDirect: Symbol = termSymbol
- /** The type symbol *directly* associated with the type
- */
+ /** The type symbol ''directly'' associated with the type. */
def typeSymbolDirect: Symbol = typeSymbol
- /** The base type underlying a type proxy,
- * identity on all other types */
+ /** The base type underlying a type proxy, identity on all other types */
def underlying: Type = this
/** Widen from singleton type to its underlying non-singleton
- * base type by applying one or more `underlying' dereferences,
+ * base type by applying one or more `underlying` dereferences,
* identity for all other types.
*
* class Outer { class C ; val x: C }
@@ -334,13 +329,14 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
*/
def deconst: Type = this
- /** The type of `this' of a class type or reference type
- */
+ /** The type of `this` of a class type or reference type. */
def typeOfThis: Type = typeSymbol.typeOfThis
/** Map to a singleton type which is a subtype of this type.
- * The fallback implemented here gives
+ * The fallback implemented here gives:
+ * {{{
* T.narrow = (T {}).this.type
+ * }}}
* Overridden where we know more about where types come from.
*
* todo: change to singleton type of an existentially defined variable
@@ -474,13 +470,13 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
*/
def decls: Scope = EmptyScope
- /** The defined or declared members with name `name' in this type;
+ /** The defined or declared members with name `name` in this type;
* an OverloadedSymbol if several exist, NoSymbol if none exist.
* Alternatives of overloaded symbol appear in the order they are declared.
*/
def decl(name: Name): Symbol = findDecl(name, 0)
- /** The non-private defined or declared members with name `name' in this type;
+ /** The non-private defined or declared members with name `name` in this type;
* an OverloadedSymbol if several exist, NoSymbol if none exist.
* Alternatives of overloaded symbol appear in the order they are declared.
*/
@@ -540,9 +536,9 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
*/
def baseType(clazz: Symbol): Type = NoType
- /** This type as seen from prefix `pre' and class `clazz'. This means:
- * Replace all thistypes of `clazz' or one of its subclasses
- * by `pre' and instantiate all parameters by arguments of `pre'.
+ /** This type as seen from prefix `pre` and class `clazz`. This means:
+ * Replace all thistypes of `clazz` or one of its subclasses
+ * by `pre` and instantiate all parameters by arguments of `pre`.
* Proceed analogously for thistypes referring to outer classes.
*
* Example:
@@ -562,18 +558,20 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
result
} else this
- /** The info of `sym', seen as a member of this type.
+ /** The info of `sym`, seen as a member of this type.
*
* Example:
+ * {{{
* class D[T] { def m: T }
* class C extends p.D[Int]
* ThisType(C).memberType(m) = Int
+ * }}}
*/
def memberInfo(sym: Symbol): Type = {
sym.info.asSeenFrom(this, sym.owner)
}
- /** The type of `sym', seen as a member of this type. */
+ /** The type of `sym`, seen as a member of this type. */
def memberType(sym: Symbol): Type = sym match {
case meth: MethodSymbol =>
meth.typeAsMemberOf(this)
@@ -588,15 +586,15 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
tp.asSeenFrom(this, sym.owner)
}
- /** Substitute types `to' for occurrences of references to
- * symbols `from' in this type.
+ /** Substitute types `to` for occurrences of references to
+ * symbols `from` in this type.
*/
def subst(from: List[Symbol], to: List[Type]): Type =
if (from.isEmpty) this
else new SubstTypeMap(from, to) apply this
- /** Substitute symbols `to' for occurrences of symbols
- * `from' in this type.
+ /** Substitute symbols `to` for occurrences of symbols `from` in this type.
+ *
* !!! NOTE !!!: If you need to do a substThis and a substSym, the substThis has to come
* first, as otherwise symbols will immediately get rebound in typeRef to the old
* symbol.
@@ -605,8 +603,8 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
if (from eq to) this
else new SubstSymMap(from, to) apply this
- /** Substitute all occurrences of `ThisType(from)' in this type
- * by `to'.
+ /** Substitute all occurrences of `ThisType(from)` in this type by `to`.
+ *
* !!! NOTE !!!: If you need to do a substThis and a substSym, the substThis has to come
* first, as otherwise symbols will immediately get rebound in typeRef to the old
* symbol.
@@ -617,23 +615,23 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
def substSuper(from: Type, to: Type): Type =
new SubstSuperMap(from, to) apply this
- /** Returns all parts of this type which satisfy predicate `p' */
+ /** Returns all parts of this type which satisfy predicate `p` */
def filter(p: Type => Boolean): List[Type] = new FilterTypeCollector(p).collect(this).toList
- /** Returns optionally first type (in a preorder traversal) which satisfies predicate `p',
+ /** Returns optionally first type (in a preorder traversal) which satisfies predicate `p`,
* or None if none exists.
*/
def find(p: Type => Boolean): Option[Type] = new FindTypeCollector(p).collect(this)
- /** Apply `f' to each part of this type */
+ /** Apply `f` to each part of this type */
def foreach(f: Type => Unit) { new ForEachTypeTraverser(f).traverse(this) }
- /** Apply `f' to each part of this type; children get mapped before their parents */
+ /** Apply `f` to each part of this type; children get mapped before their parents */
def map(f: Type => Type): Type = new TypeMap {
def apply(x: Type) = f(mapOver(x))
} apply this
- /** Is there part of this type which satisfies predicate `p'? */
+ /** Is there part of this type which satisfies predicate `p`? */
def exists(p: Type => Boolean): Boolean = !find(p).isEmpty
/** Does this type contain a reference to this symbol? */
@@ -704,8 +702,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
else isSameType(this, that))
);
- /** Does this type implement symbol `sym' with same or stronger type?
- */
+ /** Does this type implement symbol `sym` with same or stronger type? */
def specializes(sym: Symbol): Boolean =
if (explainSwitch) explain("specializes", specializesSym, this, sym)
else specializesSym(this, sym)
@@ -724,8 +721,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
*/
def matches(that: Type): Boolean = matchesType(this, that, !phase.erasedTypes)
- /** Same as matches, except that non-method types are always assumed to match.
- */
+ /** Same as matches, except that non-method types are always assumed to match. */
def looselyMatches(that: Type): Boolean = matchesType(this, that, true)
/** The shortest sorted upwards closed array of types that contains
@@ -780,12 +776,11 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
}
/** If this is a poly- or methodtype, a copy with cloned type / value parameters
- * owned by `owner'. Identity for all other types.
+ * owned by `owner`. Identity for all other types.
*/
def cloneInfo(owner: Symbol) = this
- /** Make sure this type is correct as the info of given owner; clone it if not.
- */
+ /** Make sure this type is correct as the info of given owner; clone it if not. */
def atOwner(owner: Symbol) = this
protected def objectPrefix = "object "
@@ -816,14 +811,14 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
*/
def safeToString: String = super.toString
- /** The string representation of this type, with singletypes explained */
+ /** The string representation of this type, with singletypes explained. */
def toLongString = {
val str = toString
if (str endsWith ".type") str + " (with underlying type " + widen + ")"
else str
}
- /** A test whether a type contains any unification type variables */
+ /** A test whether a type contains any unification type variables. */
def isGround: Boolean = this match {
case TypeVar(_, constr) =>
constr.instValid && constr.inst.isGround
@@ -837,9 +832,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
typeVarToOriginMap(this) eq this
}
- /** If this is a symbol loader type, load and assign a new type to
- * `sym'.
- */
+ /** If this is a symbol loader type, load and assign a new type to `sym`. */
def load(sym: Symbol) {}
private def findDecl(name: Name, excludedFlags: Int): Symbol = {
@@ -864,7 +857,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
* Find member(s) in this type. If several members matching criteria are found, they are
* returned in an OverloadedSymbol
*
- * @param name The member's name, where nme.ANYNAME means `unspecified'
+ * @param name The member's name, where nme.ANYNAME means `unspecified`
* @param excludedFlags Returned members do not have these flags
* @param requiredFlags Returned members do have these flags
* @param stableOnly If set, return only members that are types or stable values
@@ -1171,9 +1164,8 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
}
}
- /** A class for singleton types of the form <prefix>.<sym.name>.type.
- * Cannot be created directly; one should always use
- * `singleType' for creation.
+ /** A class for singleton types of the form `<prefix>.<sym.name>.type`.
+ * Cannot be created directly; one should always use `singleType` for creation.
*/
abstract case class SingleType(pre: Type, sym: Symbol) extends SingletonType {
override val isTrivial: Boolean = pre.isTrivial
@@ -1421,9 +1413,9 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
}
/** A class representing intersection types with refinements of the form
- * `<parents_0> with ... with <parents_n> { decls }'
+ * `<parents_0> with ... with <parents_n> { decls }`
* Cannot be created directly;
- * one should always use `refinedType' for creation.
+ * one should always use `refinedType` for creation.
*/
case class RefinedType(override val parents: List[Type],
override val decls: Scope) extends CompoundType {
@@ -1468,7 +1460,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
* either i > 1, or decls or a following parent Pj, j > 1, contributes
* an abstract member.
* A type contributes an abstract member if it has an abstract member which
- * is also a member of the whole refined type. A scope `decls' contributes
+ * is also a member of the whole refined type. A scope `decls` contributes
* an abstract member if it has an abstract definition which is also
* a member of the whole type.
*/
@@ -1532,7 +1524,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
getRefs(Expansive, tparam)
}
- /* The rest of this class is auxiliary code for `expansiveRefs'
+ /* The rest of this class is auxiliary code for `expansiveRefs`
*/
/** The type parameters which are referenced type parameters of this class.
@@ -1562,7 +1554,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
}
/** Augment existing refs map with references <pre>from -> sym</pre>, for
- * all elements <pre>sym</pre> of set `to'.
+ * all elements <pre>sym</pre> of set `to`.
* @param which <- {NonExpansive, Expansive}
*/
private def addRefs(which: Int, from: Symbol, to: Set[Symbol]) {
@@ -1578,7 +1570,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
// (this can happen only for erroneous programs).
}
- /** Compute initial (one-step) references and set state to `Initializing'.
+ /** Compute initial (one-step) references and set state to `Initializing`.
*/
private def computeRefs() {
refs = Array(Map(), Map())
@@ -1662,8 +1654,8 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
}
final class UniqueConstantType(value: Constant) extends ConstantType(value) with UniqueType {
- /** Save the type of 'value'. For Java enums, it depends on finding the linked class,
- * which might not be found after 'flatten'. */
+ /** Save the type of `value`. For Java enums, it depends on finding the linked class,
+ * which might not be found after `flatten`. */
private lazy val _tpe: Type = value.tpe
override def underlying: Type = _tpe
}
@@ -1677,8 +1669,8 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
private val pendingVolatiles = new mutable.HashSet[Symbol]
/** A class for named types of the form
- * `<prefix>.<sym.name>[args]'
- * Cannot be created directly; one should always use `typeRef'
+ * `<prefix>.<sym.name>[args]`
+ * Cannot be created directly; one should always use `typeRef`
* for creation. (@M: Otherwise hashing breaks)
*
* @M: a higher-kinded type is represented as a TypeRef with sym.info.typeParams.nonEmpty, but args.isEmpty
@@ -1747,7 +1739,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
override def isNotNull =
sym.isModuleClass || sym == NothingClass || isValueClass(sym) || super.isNotNull
- // @M: propagate actual type params (args) to `tp', by replacing formal type parameters with actual ones
+ // @M: propagate actual type params (args) to `tp`, by replacing formal type parameters with actual ones
// if tp is higher kinded, the "actual" type arguments are types that simply reference the corresponding type parameters (unbound type variables)
def transform(tp: Type): Type = {
val res = tp.asSeenFrom(pre, sym.owner)
@@ -1787,11 +1779,11 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
override def termSymbolDirect = super.termSymbol
/* @MAT
-whenever you see `tp.typeSymbol.isXXXX' and then act on tp based on that predicate, you're on thin ice,
-as `typeSymbol' (and `prefix') automatically normalize, but the other inspectors don't.
-In other words, even if `tp.normalize.sym.isXXX' is true, `tp.sym.isXXX' may be false (if sym were a public method to access the non-normalized typeSymbol)...
+whenever you see `tp.typeSymbol.isXXXX` and then act on tp based on that predicate, you're on thin ice,
+as `typeSymbol` (and `prefix`) automatically normalize, but the other inspectors don't.
+In other words, even if `tp.normalize.sym.isXXX` is true, `tp.sym.isXXX` may be false (if sym were a public method to access the non-normalized typeSymbol)...
-In retrospect, I think `tp.typeSymbol.isXXX' or (worse) `tp.typeSymbol==XXX' should be replaced by `val tp = tp0.asXXX'.
+In retrospect, I think `tp.typeSymbol.isXXX` or (worse) `tp.typeSymbol==XXX` should be replaced by `val tp = tp0.asXXX`.
A type's typeSymbol should never be inspected directly.
*/
@@ -1843,7 +1835,7 @@ A type's typeSymbol should never be inspected directly.
override def typeParams: List[Symbol] = if (isHigherKinded) typeParamsDirect else List()
override def typeConstructor = TypeRef(pre, sym, Nil)
- // note: does not go through typeRef. There's no need to because neither `pre' nor `sym' changes.
+ // note: does not go through typeRef. There's no need to because neither `pre` nor `sym` changes.
// And there's a performance advantage to call TypeRef directly.
@@ -2292,7 +2284,7 @@ A type's typeSymbol should never be inspected directly.
}
/** A class containing the alternatives and type prefix of an overloaded symbol.
- * Not used after phase `typer'.
+ * Not used after phase `typer`.
*/
case class OverloadedType(pre: Type, alternatives: List[Symbol]) extends Type {
override def prefix: Type = pre
@@ -2303,7 +2295,7 @@ A type's typeSymbol should never be inspected directly.
/** A class remembering a type instantiation for some a set of overloaded
* polymorphic symbols.
- * Not used after phase `typer'.
+ * Not used after phase `typer`.
*/
case class AntiPolyType(pre: Type, targs: List[Type]) extends Type {
override def safeToString =
@@ -2358,7 +2350,7 @@ A type's typeSymbol should never be inspected directly.
}
/** A class representing a type variable
- * Not used after phase `typer'.
+ * Not used after phase `typer`.
* A higher-kinded type variable has type arguments (a list of Type's) and type parameters (list of Symbols)
* A TypeVar whose list of args is non-empty can only be instantiated by a higher-kinded type that can be applied to these args
* a typevar is much like a typeref, except it has special logic for type equality/subtyping
@@ -2375,11 +2367,10 @@ A type's typeSymbol should never be inspected directly.
/** The variable's skolemization level */
val level = skolemizationLevel
- /**
- * two occurrences of a higher-kinded typevar, e.g. ?CC[Int] and ?CC[String], correspond to
- * *two instances* of TypeVar that share the *same* TypeConstraint
- * constr for ?CC only tracks type constructors anyway, so when ?CC[Int] <:< List[Int] and ?CC[String] <:< Iterable[String]
- * ?CC's hibounds contains List and Iterable
+ /** Two occurrences of a higher-kinded typevar, e.g. `?CC[Int]` and `?CC[String]`, correspond to
+ * ''two instances'' of `TypeVar` that share the ''same'' `TypeConstraint`
+ * `constr` for `?CC` only tracks type constructors anyway, so when `?CC[Int] <:< List[Int]` and `?CC[String] <:< Iterable[String]`
+ * `?CC's` hibounds contains List and Iterable
*/
def applyArgs(newArgs: List[Type]): TypeVar =
if (newArgs.isEmpty) this // SubstMap relies on this (though this check is redundant when called from appliedType...)
@@ -2453,18 +2444,24 @@ A type's typeSymbol should never be inspected directly.
* no type parameters, or we are comparing to Any/Nothing.
*
* The latter condition is needed because HK unification is limited to constraints of the shape
+ * {{{
* TC1[T1,..., TN] <: TC2[T'1,...,T'N]
+ * }}}
* which would preclude the following important constraints:
+ * {{{
* Nothing <: ?TC[?T]
* ?TC[?T] <: Any
+ * }}}
*/
def unifySimple = (params.isEmpty || tp.typeSymbol == NothingClass || tp.typeSymbol == AnyClass) &&
addBound(tp)
/** Full case: involving a check of the form
+ * {{{
* TC1[T1,..., TN] <: TC2[T'1,...,T'N]
+ * }}}
* Checks subtyping of higher-order type vars, and uses variances as defined in the
- * type parameter we're trying to infer (the result will be sanity-checked later)
+ * type parameter we're trying to infer (the result will be sanity-checked later).
*/
def unifyFull(tp: Type) = sameLength(typeArgs, tp.typeArgs) && { // this is a higher-kinded type var with same arity as tp
// side effect: adds the type constructor itself as a bound
@@ -2473,8 +2470,7 @@ A type's typeSymbol should never be inspected directly.
else isSubArgs(typeArgs, tp.typeArgs, params)
}
- /** TODO: need positive/negative test cases demonstrating this is correct.
- */
+ /** TODO: need positive/negative test cases demonstrating this is correct. */
def unifyParents =
if (isLowerBound) tp.parents exists unifyFull
else tp.parents forall unifyFull
@@ -2508,10 +2504,10 @@ A type's typeSymbol should never be inspected directly.
}
/**
- * ?A.T =:= tp is rewritten as the constraint ?A <: {type T = tp}
+ * `?A.T =:= tp` is rewritten as the constraint `?A <: {type T = tp}`
*
- * TODO: make these constraints count (incorporate them into implicit search in applyImplicitArgs)
- * (T corresponds to @param sym)
+ * TODO: make these constraints count (incorporate them into implicit search in `applyImplicitArgs`)
+ * (`T` corresponds to @param sym)
*/
def registerTypeSelection(sym: Symbol, tp: Type): Boolean = {
val bound = refinedType(List(WildcardType), NoSymbol)
@@ -2521,8 +2517,8 @@ A type's typeSymbol should never be inspected directly.
registerBound(bound, false)
}
- /** Can this variable be related in a constraint to type `tp'?
- * This is not the case if `tp' contains type skolems whose
+ /** Can this variable be related in a constraint to type `tp`?
+ * This is not the case if `tp` contains type skolems whose
* skolemization level is higher than the level of this variable.
*/
def isRelatable(tp: Type): Boolean =
@@ -2563,12 +2559,12 @@ A type's typeSymbol should never be inspected directly.
}
/** A type carrying some annotations. Created by the typechecker
- * when eliminating ``Annotated'' trees (see typedAnnotated).
+ * when eliminating ''Annotated'' trees (see typedAnnotated).
*
* @param annotations the list of annotations on the type
* @param underlying the type without the annotation
- * @param selfsym a "self" symbol with type <code>underlying</code>;
- * only available if -Yself-in-annots is turned on. Can be NoSymbol
+ * @param selfsym a "self" symbol with type `underlying`;
+ * only available if -Yself-in-annots is turned on. Can be `NoSymbol`
* if it is not used.
*/
case class AnnotatedType(override val annotations: List[AnnotationInfo],
@@ -2653,8 +2649,7 @@ A type's typeSymbol should never be inspected directly.
// Creators ---------------------------------------------------------------
- /** Rebind symbol `sym' to an overriding member in type `pre'.
- */
+ /** Rebind symbol `sym` to an overriding member in type `pre`. */
private def rebind(pre: Type, sym: Symbol): Symbol = {
val owner = sym.owner
if (owner.isClass && owner != pre.typeSymbol && !sym.isEffectivelyFinal && !sym.isClass) {
@@ -2668,9 +2663,7 @@ A type's typeSymbol should never be inspected directly.
} else sym
}
- /** Convert a `super' prefix to a this-type if `sym'
- * is abstract or final.
- */
+ /** Convert a `super` prefix to a this-type if `sym` is abstract or final. */
private def removeSuper(tp: Type, sym: Symbol): Type = tp match {
case SuperType(thistp, _) =>
if (sym.isEffectivelyFinal || sym.isDeferred) thistp
@@ -2845,14 +2838,14 @@ A type's typeSymbol should never be inspected directly.
}
/** A creator for type parameterizations that strips empty type parameter lists.
- * Use this factory method to indicate the type has kind * (it's a polymorphic value)
- * until we start tracking explicit kinds equivalent to typeFun (except that the latter requires tparams nonEmpty)
+ * Use this factory method to indicate the type has kind * (it's a polymorphic value)
+ * until we start tracking explicit kinds equivalent to typeFun (except that the latter requires tparams nonEmpty).
*/
def polyType(tparams: List[Symbol], tpe: Type): Type =
if (tparams nonEmpty) typeFun(tparams, tpe)
else tpe // it's okay to be forgiving here
- /** A creator for anonymous type functions, where the symbol for the type function still needs to be created
+ /** A creator for anonymous type functions, where the symbol for the type function still needs to be created.
*
* TODO:
* type params of anonymous type functions, which currently can only arise from normalising type aliases, are owned by the type alias of which they are the eta-expansion
@@ -2860,23 +2853,22 @@ A type's typeSymbol should never be inspected directly.
*/
def typeFunAnon(tps: List[Symbol], body: Type): Type = typeFun(tps, body)
- /** A creator for a type functions, assuming the type parameters tps already have the right owner
- */
+ /** A creator for a type functions, assuming the type parameters tps already have the right owner. */
def typeFun(tps: List[Symbol], body: Type): Type = PolyType(tps, body)
/** A creator for existential types. This generates:
*
* tpe1 where { tparams }
*
- * where `tpe1' is the result of extrapolating `tpe' wrt to `tparams'. Extrapolating means
- * that type variables in `tparams' occurring in covariant positions are replaced by upper bounds,
+ * where `tpe1` is the result of extrapolating `tpe` wrt to `tparams`. Extrapolating means
+ * that type variables in `tparams` occurring in covariant positions are replaced by upper bounds,
* (minus any SingletonClass markers),
- * type variables in `tparams' occurring in contravariant positions are replaced by upper bounds,
+ * type variables in `tparams` occurring in contravariant positions are replaced by upper bounds,
* provided the resulting type is legal wrt to stability, and does not contain any
- * type variable in `tparams'.
+ * type variable in `tparams`.
* The abstraction drops all type parameters that are not directly or indirectly
- * referenced by type `tpe1'.
- * If there are no remaining type parameters, simply returns result type `tpe'.
+ * referenced by type `tpe1`.
+ * If there are no remaining type parameters, simply returns result type `tpe`.
*/
def existentialAbstraction(tparams: List[Symbol], tpe0: Type): Type =
if (tparams.isEmpty) tpe0
@@ -3346,19 +3338,19 @@ A type's typeSymbol should never be inspected directly.
def isRaw(sym: Symbol, args: List[Type]) =
!phase.erasedTypes && isRawIfWithoutArgs(sym) && args.isEmpty
- /** Is type tp a ``raw type''? */
+ /** Is type tp a ''raw type''? */
def isRawType(tp: Type) = tp match {
case TypeRef(_, sym, args) => isRaw(sym, args)
case _ => false
}
- /** The raw to existential map converts a ``raw type'' to an existential type.
+ /** The raw to existential map converts a ''raw type'' to an existential type.
* It is necessary because we might have read a raw type of a
* parameterized Java class from a class file. At the time we read the type
* the corresponding class file might still not be read, so we do not
* know what the type parameters of the type are. Therefore
* the conversion of raw types to existential types might not have taken place
- * in ClassFileparser.sigToType (where it is usually done)
+ * in ClassFileparser.sigToType (where it is usually done).
*/
object rawToExistential extends TypeMap {
private var expanded = immutable.Set[Symbol]()
@@ -3428,7 +3420,7 @@ A type's typeSymbol should never be inspected directly.
qvar
}).tpe
- /** Return pre.baseType(clazz), or if that's NoType and clazz is a refinement, pre itself.
+ /** Return `pre.baseType(clazz)`, or if that's `NoType` and `clazz` is a refinement, `pre` itself.
* See bug397.scala for an example where the second alternative is needed.
* The problem is that when forming the base type sequence of an abstract type,
* any refinements in the base type list might be regenerated, and thus acquire
@@ -3526,9 +3518,7 @@ A type's typeSymbol should never be inspected directly.
val fromContains = (x: Symbol) => from.contains(x) //from.toSet <-- traversing short lists seems to be faster than allocating sets
assert(sameLength(from, to), "Unsound substitution from "+ from +" to "+ to)
- /** Are `sym' and `sym1' the same.
- * Can be tuned by subclasses.
- */
+ /** Are `sym` and `sym1` the same? Can be tuned by subclasses. */
protected def matches(sym: Symbol, sym1: Symbol): Boolean = sym eq sym1
/** Map target to type, can be tuned by subclasses */
@@ -3581,7 +3571,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to implement the `substSym' method. */
+ /** A map to implement the `substSym` method. */
class SubstSymMap(from: List[Symbol], to: List[Symbol]) extends SubstMap(from, to) {
protected def toType(fromtp: Type, sym: Symbol) = fromtp match {
case TypeRef(pre, _, args) => copyTypeRef(fromtp, pre, sym, args)
@@ -3637,7 +3627,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to implement the `subst' method. */
+ /** A map to implement the `subst` method. */
class SubstTypeMap(from: List[Symbol], to: List[Type])
extends SubstMap(from, to) {
protected def toType(fromtp: Type, tp: Type) = tp
@@ -3659,7 +3649,7 @@ A type's typeSymbol should never be inspected directly.
}
- /** A map to implement the `substThis' method. */
+ /** A map to implement the `substThis` method. */
class SubstThisMap(from: Symbol, to: Type) extends TypeMap {
def apply(tp: Type): Type = tp match {
case ThisType(sym) if (sym == from) => to
@@ -3799,8 +3789,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to convert every occurrence of a type variable to a
- wildcard type */
+ /** A map to convert every occurrence of a type variable to a wildcard type. */
object typeVarToOriginMap extends TypeMap {
def apply(tp: Type): Type = tp match {
case TypeVar(origin, _) => origin
@@ -3808,7 +3797,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to implement the `contains' method */
+ /** A map to implement the `contains` method. */
class ContainsCollector(sym: Symbol) extends TypeCollector(false) {
def traverse(tp: Type) {
if (!result) {
@@ -3830,7 +3819,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to implement the `contains' method */
+ /** A map to implement the `contains` method. */
class ContainsTypeCollector(t: Type) extends TypeCollector(false) {
def traverse(tp: Type) {
if (!result) {
@@ -3846,7 +3835,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to implement the `filter' method */
+ /** A map to implement the `filter` method. */
class FilterTypeCollector(p: Type => Boolean) extends TypeCollector(new ListBuffer[Type]) {
def traverse(tp: Type) {
if (p(tp)) result += tp
@@ -3861,7 +3850,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to implement the `filter' method */
+ /** A map to implement the `filter` method. */
class FindTypeCollector(p: Type => Boolean) extends TypeCollector[Option[Type]](None) {
def traverse(tp: Type) {
if (result.isEmpty) {
@@ -3871,7 +3860,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** A map to implement the `contains' method */
+ /** A map to implement the `contains` method. */
object ErroneousCollector extends TypeCollector(false) {
def traverse(tp: Type) {
if (!result) {
@@ -4041,9 +4030,9 @@ A type's typeSymbol should never be inspected directly.
final val LubGlbMargin = 0
- /** The maximum allowable depth of lubs or glbs over types `ts'
+ /** The maximum allowable depth of lubs or glbs over types `ts`.
* This is the maximum depth of all types in the base type sequences
- * of each of the types `ts', plus LubGlbMargin
+ * of each of the types `ts`, plus LubGlbMargin.
*/
def lubDepth(ts: List[Type]) = {
var d = 0
@@ -4091,8 +4080,8 @@ A type's typeSymbol should never be inspected directly.
check(tp1, tp2)/* && check(tp2, tp1)*/ // need to investgate why this can't be made symmetric -- neg/gadts1 fails, and run/existials also.
}
- /** Does a pattern of type `patType' need an outer test when executed against
- * selector type `selType' in context defined by `currentOwner'?
+ /** Does a pattern of type `patType` need an outer test when executed against
+ * selector type `selType` in context defined by `currentOwner`?
*/
def needsOuterTest(patType: Type, selType: Type, currentOwner: Symbol) = {
def createDummyClone(pre: Type): Type = {
@@ -4150,8 +4139,7 @@ A type's typeSymbol should never be inspected directly.
if (sym1 == sym2) sym1.hasPackageFlag || phase.erasedTypes || pre1 =:= pre2
else (sym1.name == sym2.name) && isUnifiable(pre1, pre2)
- /** Do `tp1' and `tp2' denote equivalent types?
- */
+ /** Do `tp1` and `tp2` denote equivalent types? */
def isSameType(tp1: Type, tp2: Type): Boolean = try {
incCounter(sametypeCount)
subsametypeRecursions += 1
@@ -4480,9 +4468,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** Are `tps1' and `tps2' lists of pairwise equivalent
- * types?
- */
+ /** Are `tps1` and `tps2` lists of pairwise equivalent types? */
def isSameTypes(tps1: List[Type], tps2: List[Type]): Boolean = (tps1 corresponds tps2)(_ =:= _)
/** True if two lists have the same length. Since calling length on linear sequences
@@ -4618,8 +4604,7 @@ A type's typeSymbol should never be inspected directly.
def differentOrNone(tp1: Type, tp2: Type) = if (tp1 eq tp2) NoType else tp1
- /** Does type `tp1' conform to `tp2'?
- */
+ /** Does type `tp1` conform to `tp2`? */
private def isSubType2(tp1: Type, tp2: Type, depth: Int): Boolean = {
if ((tp1 eq tp2) || isErrorOrWildcard(tp1) || isErrorOrWildcard(tp2)) return true
if ((tp1 eq NoType) || (tp2 eq NoType)) return false
@@ -4807,14 +4792,13 @@ A type's typeSymbol should never be inspected directly.
firstTry
}
- /** Are `tps1' and `tps2' lists of equal length such
- * that all elements of `tps1' conform to corresponding elements
- * of `tps2'?
+ /** Are `tps1` and `tps2` lists of equal length such that all elements
+ * of `tps1` conform to corresponding elements of `tps2`?
*/
def isSubTypes(tps1: List[Type], tps2: List[Type]): Boolean = (tps1 corresponds tps2)(_ <:< _)
- /** Does type `tp' implement symbol `sym' with same or
- * stronger type? Exact only if `sym' is a member of some
+ /** Does type `tp` implement symbol `sym` with same or
+ * stronger type? Exact only if `sym` is a member of some
* refinement type, otherwise we might return false negatives.
*/
def specializesSym(tp: Type, sym: Symbol): Boolean =
@@ -4823,8 +4807,8 @@ A type's typeSymbol should never be inspected directly.
(tp.nonPrivateMember(sym.name).alternatives exists
(alt => sym == alt || specializesSym(tp.narrow, alt, sym.owner.thisType, sym)))
- /** Does member `sym1' of `tp1' have a stronger type
- * than member `sym2' of `tp2'?
+ /** Does member `sym1` of `tp1` have a stronger type
+ * than member `sym2` of `tp2`?
*/
private def specializesSym(tp1: Type, sym1: Symbol, tp2: Type, sym2: Symbol): Boolean = {
val info1 = tp1.memberInfo(sym1)
@@ -4840,7 +4824,7 @@ A type's typeSymbol should never be inspected directly.
sym2.isAliasType && tp2.memberType(sym2).substThis(tp2.typeSymbol, tp1) =:= tp1.memberType(sym1) //@MAT ok
}
- /** A function implementing `tp1' matches `tp2' */
+ /** A function implementing `tp1` matches `tp2`. */
final def matchesType(tp1: Type, tp2: Type, alwaysMatchSimple: Boolean): Boolean = {
def matchesQuantified(tparams1: List[Symbol], tparams2: List[Symbol], res1: Type, res2: Type): Boolean = (
sameLength(tparams1, tparams2) &&
@@ -4944,7 +4928,7 @@ A type's typeSymbol should never be inspected directly.
}
*/
- /** Are `syms1' and `syms2' parameter lists with pairwise equivalent types? */
+ /** Are `syms1` and `syms2` parameter lists with pairwise equivalent types? */
private def matchingParams(syms1: List[Symbol], syms2: List[Symbol], syms1isJava: Boolean, syms2isJava: Boolean): Boolean = syms1 match {
case Nil =>
syms2.isEmpty
@@ -4962,8 +4946,8 @@ A type's typeSymbol should never be inspected directly.
}
}
- /** like map2, but returns list `xs' itself - instead of a copy - if function
- * `f' maps all elements to themselves.
+ /** like map2, but returns list `xs` itself - instead of a copy - if function
+ * `f` maps all elements to themselves.
*/
def map2Conserve[A <: AnyRef, B](xs: List[A], ys: List[B])(f: (A, B) => A): List[A] =
if (xs.isEmpty) xs
@@ -4974,13 +4958,13 @@ A type's typeSymbol should never be inspected directly.
else x1 :: xs1
}
- /** Solve constraint collected in types `tvars'.
+ /** Solve constraint collected in types `tvars`.
*
* @param tvars All type variables to be instantiated.
- * @param tparams The type parameters corresponding to `tvars'
+ * @param tparams The type parameters corresponding to `tvars`
* @param variances The variances of type parameters; need to reverse
* solution direction for all contravariant variables.