Skip to content

Commit 4af7703

Browse files
committed
Address doc comment rot in the standard library.
- Match @param/@tparam names to the actual parameter name - Use @tparam for type parameters - Whitespace is required between `*` and `@` - Fix incorrect references to @define macros. - Use of monospace `` and {{{}}} (much more needed) - Remove `@param p1 ...` stubs, which appear in the generated docss. - But, retainsed `@param p1` stubs, assuming they will be filtered from the generated docs by SI-5795. - Avoid use of the shorthand `@param doc for the solitary param` (which works, but isn't recognized by the code inspection in IntelliJ I used to sweep through the problems) The remaining warnings from `ant docs` seem spurious, I suspect they are an unintended consequence of documenting extension methods. [scaladoc] /Users/jason/code/scala/src/library/scala/collection/TraversableOnce.scala:181: warning: Variable coll undefined in comment for method reduceOption in class Tuple2Zipped [scaladoc] def reduceOption[A1 >: A](op: (A1, A1) => A1): Option[A1] = reduceLeftOption(op) [scaladoc] ^
1 parent 4cd0253 commit 4af7703

File tree

94 files changed

+204
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+204
-370
lines changed

src/library/scala/Array.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ object Array extends FallbackArrayBuilding {
362362

363363
/** Returns an array containing a sequence of increasing integers in a range.
364364
*
365-
* @param from the start value of the array
366-
* @param end the end value of the array, exclusive (in other words, this is the first value '''not''' returned)
365+
* @param start the start value of the array
366+
* @param end the end value of the array, exclusive (in other words, this is the first value '''not''' returned)
367367
* @return the array with values in range `start, start + 1, ..., end - 1`
368368
* up to, but excluding, `end`.
369369
*/

src/library/scala/Console.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ object Console {
186186
* }
187187
* }}}
188188
*
189-
* @param in the new input stream.
190189
* @param thunk the code to execute with
191190
* the new input stream active
192191
*

src/library/scala/Either.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ object Either {
297297
* Left(12).left.foreach(x => println(x)) // prints "12"
298298
* Right(12).left.foreach(x => println(x)) // doesn't print
299299
* }}}
300-
* @param e The side-effecting function to execute.
300+
* @param f The side-effecting function to execute.
301301
*/
302302
def foreach[U](f: A => U) = e match {
303303
case Left(a) => f(a)
@@ -358,7 +358,7 @@ object Either {
358358
* Left(12).left.flatMap(x => Left("scala")) // Left("scala")
359359
* Right(12).left.flatMap(x => Left("scala") // Right(12)
360360
* }}}
361-
* @param The function to bind across `Left`.
361+
* @param f The function to bind across `Left`.
362362
*/
363363
def flatMap[BB >: B, X](f: A => Either[X, BB]) = e match {
364364
case Left(a) => f(a)
@@ -462,7 +462,7 @@ object Either {
462462
* Right(12).right.foreach(x => println(x)) // prints "12"
463463
* Left(12).right.foreach(x => println(x)) // doesn't print
464464
* }}}
465-
* @param e The side-effecting function to execute.
465+
* @param f The side-effecting function to execute.
466466
*/
467467
def foreach[U](f: B => U) = e match {
468468
case Left(_) => {}
@@ -516,7 +516,7 @@ object Either {
516516
/**
517517
* Binds the given function across `Right`.
518518
*
519-
* @param The function to bind across `Right`.
519+
* @param f The function to bind across `Right`.
520520
*/
521521
def flatMap[AA >: A, Y](f: B => Either[AA, Y]) = e match {
522522
case Left(a) => Left(a)

src/library/scala/Function.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ object Function {
2020
* function `f,,1,, andThen ... andThen f,,n,,`.
2121
*
2222
* @param fs The given sequence of functions
23-
* @return ...
2423
*/
2524
def chain[a](fs: Seq[a => a]): a => a = { x => (x /: fs) ((x, f) => f(x)) }
2625

@@ -72,9 +71,6 @@ object Function {
7271
*
7372
* @note These functions are slotted for deprecation, but it is on
7473
* hold pending superior type inference for tupling anonymous functions.
75-
*
76-
* @param f ...
77-
* @return ...
7874
*/
7975
// @deprecated("Use `f.tupled` instead")
8076
def tupled[a1, a2, b](f: (a1, a2) => b): Tuple2[a1, a2] => b = {

src/library/scala/Option.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
146146

147147
/** Returns the result of applying $f to this $option's
148148
* value if the $option is nonempty. Otherwise, evaluates
149-
* expression $ifEmpty.
149+
* expression `ifEmpty`.
150150
*
151151
* @note This is equivalent to `$option map f getOrElse ifEmpty`.
152152
*

src/library/scala/Predef.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ object Predef extends LowPriorityImplicits {
160160
* is at least `ASSERTION`.
161161
*
162162
* @see elidable
163-
* @param p the expression to test
163+
* @param assertion the expression to test
164164
*/
165165
@elidable(ASSERTION)
166166
def assert(assertion: Boolean) {
@@ -173,8 +173,8 @@ object Predef extends LowPriorityImplicits {
173173
* is at least `ASSERTION`.
174174
*
175175
* @see elidable
176-
* @param p the expression to test
177-
* @param msg a String to include in the failure message
176+
* @param assertion the expression to test
177+
* @param message a String to include in the failure message
178178
*/
179179
@elidable(ASSERTION) @inline
180180
final def assert(assertion: Boolean, message: => Any) {
@@ -189,7 +189,7 @@ object Predef extends LowPriorityImplicits {
189189
* will not be generated if `-Xelide-below` is at least `ASSERTION`.
190190
*
191191
* @see elidable
192-
* @param p the expression to test
192+
* @param assumption the expression to test
193193
*/
194194
@elidable(ASSERTION)
195195
def assume(assumption: Boolean) {
@@ -204,8 +204,8 @@ object Predef extends LowPriorityImplicits {
204204
* will not be generated if `-Xelide-below` is at least `ASSERTION`.
205205
*
206206
* @see elidable
207-
* @param p the expression to test
208-
* @param msg a String to include in the failure message
207+
* @param assumption the expression to test
208+
* @param message a String to include in the failure message
209209
*/
210210
@elidable(ASSERTION) @inline
211211
final def assume(assumption: Boolean, message: => Any) {
@@ -217,7 +217,7 @@ object Predef extends LowPriorityImplicits {
217217
* This method is similar to `assert`, but blames the caller of the method
218218
* for violating the condition.
219219
*
220-
* @param p the expression to test
220+
* @param requirement the expression to test
221221
*/
222222
def require(requirement: Boolean) {
223223
if (!requirement)
@@ -228,8 +228,8 @@ object Predef extends LowPriorityImplicits {
228228
* This method is similar to `assert`, but blames the caller of the method
229229
* for violating the condition.
230230
*
231-
* @param p the expression to test
232-
* @param msg a String to include in the failure message
231+
* @param requirement the expression to test
232+
* @param message a String to include in the failure message
233233
*/
234234
@inline final def require(requirement: Boolean, message: => Any) {
235235
if (!requirement)

src/library/scala/Product.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package scala
1919
*/
2020
trait Product extends Any with Equals {
2121
/** The n^th^ element of this product, 0-based. In other words, for a
22-
* product `A(x,,1,,, ..., x,,k,,)`, returns `x,,(n+1),, where `0 < n < k`.
22+
* product `A(x,,1,,, ..., x,,k,,)`, returns `x,,(n+1),,` where `0 < n < k`.
2323
*
2424
* @param n the index of the element to return
2525
* @throws `IndexOutOfBoundsException`

src/library/scala/Responder.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@ package scala
2121
object Responder {
2222

2323
/** Creates a responder that answer continuations with the constant `a`.
24-
*
25-
* @param x ...
26-
* @return ...
2724
*/
2825
def constant[A](x: A) = new Responder[A] {
2926
def respond(k: A => Unit) = k(x)
3027
}
3128

3229
/** Executes `x` and returns `'''true'''`, useful as syntactic
3330
* convenience in for comprehensions.
34-
*
35-
* @param x ...
36-
* @return ...
3731
*/
3832
def exec[A](x: => Unit): Boolean = { x; true }
3933

src/library/scala/StringContext.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ object StringContext {
132132
* escape: `\\`, `\"`, `\'`
133133
* octal: `\d` `\dd` `\ddd` where `d` is an octal digit between `0` and `7`.
134134
*
135-
* @param A string that may contain escape sequences
135+
* @param str A string that may contain escape sequences
136136
* @return The string with all escape sequences expanded.
137137
*/
138138
def treatEscapes(str: String): String = {

src/library/scala/annotation/elidable.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ import java.util.logging.Level
1818
* be omitted from generated code if the priority given the annotation
1919
* is lower than that given on the command line.
2020
*
21+
* {{{
2122
* @elidable(123) // annotation priority
2223
* scalac -Xelide-below 456 // command line priority
23-
*
24+
* }}}
25+
*
2426
* The method call will be replaced with an expression which depends on
2527
* the type of the elided expression. In decreasing order of precedence:
2628
*
29+
* {{{
2730
* Unit ()
2831
* Boolean false
2932
* T <: AnyVal 0
3033
* T >: Null null
3134
* T >: Nothing Predef.???
32-
*
35+
* }}}
36+
*
3337
* Complete example:
3438
{{{
3539
import annotation._, elidable._

src/library/scala/collection/BitSetLike.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe
137137

138138
/** Computes the intersection between this bitset and another bitset by performing
139139
* a bitwise "and".
140-
* @param that the bitset to intersect with.
140+
* @param other the bitset to intersect with.
141141
* @return a new bitset consisting of all elements that are both in this
142142
* bitset and in the given bitset `other`.
143143
*/
@@ -152,7 +152,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe
152152
/** Computes the difference of this bitset and another bitset by performing
153153
* a bitwise "and-not".
154154
*
155-
* @param that the set of bits to exclude.
155+
* @param other the set of bits to exclude.
156156
* @return a bitset containing those bits of this
157157
* bitset that are not also contained in the given bitset `other`.
158158
*/
@@ -167,7 +167,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe
167167
/** Computes the symmetric difference of this bitset and another bitset by performing
168168
* a bitwise "exclusive-or".
169169
*
170-
* @param that the other bitset to take part in the symmetric difference.
170+
* @param other the other bitset to take part in the symmetric difference.
171171
* @return a bitset containing those bits of this
172172
* bitset or the other bitset that are not contained in both bitsets.
173173
*/
@@ -184,7 +184,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe
184184

185185
/** Tests whether this bitset is a subset of another bitset.
186186
*
187-
* @param that the bitset to test.
187+
* @param other the bitset to test.
188188
* @return `true` if this bitset is a subset of `other`, i.e. if
189189
* every bit of this set is also an element in `other`.
190190
*/

src/library/scala/collection/GenIterableLike.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ trait GenIterableLike[+A, +Repr] extends Any with GenTraversableLike[A, Repr] {
4141
/** Checks if the other iterable collection contains the same elements in the same order as this $coll.
4242
*
4343
* @param that the collection to compare with.
44-
* @tparam B the type of the elements of collection `that`.
44+
* @tparam A1 the type of the elements of collection `that`.
4545
* @return `true`, if both collections contain the same elements in the same order, `false` otherwise.
4646
*
4747
* @usecase def sameElements(that: GenIterable[A]): Boolean
@@ -87,13 +87,13 @@ trait GenIterableLike[+A, +Repr] extends Any with GenTraversableLike[A, Repr] {
8787
* @tparam A1 the type of the first half of the returned pairs (this is always a supertype
8888
* of the collection's element type `A`).
8989
* @tparam That the class of the returned collection. Where possible, `That` is
90-
* the same class as the current collection class `Repr`, but this
91-
* depends on the element type `(A1, Int)` being admissible for that class,
92-
* which means that an implicit instance of type `CanBuildFrom[Repr, (A1, Int), That]`.
93-
* is found.
94-
* @tparam bf an implicit value of class `CanBuildFrom` which determines the
95-
* result class `That` from the current representation type `Repr`
96-
* and the new element type `(A1, Int)`.
90+
* the same class as the current collection class `Repr`, but this
91+
* depends on the element type `(A1, Int)` being admissible for that class,
92+
* which means that an implicit instance of type `CanBuildFrom[Repr, (A1, Int), That]`.
93+
* is found.
94+
* @param bf an implicit value of class `CanBuildFrom` which determines the
95+
* result class `That` from the current representation type `Repr`
96+
* and the new element type `(A1, Int)`.
9797
* @return A new collection of type `That` containing pairs consisting of all elements of this
9898
* $coll paired with their index. Indices start at `0`.
9999
*

src/library/scala/collection/GenMapLike.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ trait GenMapLike[A, +B, +Repr] extends GenIterableLike[(A, B), Repr] with Equals
4242
* otherwise the result of the `default` computation.
4343
* @usecase def getOrElse(key: A, default: => B): B
4444
* @inheritdoc
45-
* @tparam B the result type of the default computation.
4645
*/
4746
def getOrElse[B1 >: B](key: A, default: => B1): B1
4847

src/library/scala/collection/GenSeqLike.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,6 @@ trait GenSeqLike[+A, +Repr] extends Any with GenIterableLike[A, Repr] with Equal
413413
*
414414
* @param that the sequence of elements to remove
415415
* @tparam B the element type of the returned $coll.
416-
* @tparam That $thatinfo
417-
* @param bf $bfinfo
418416
* @return a new collection of type `That` which contains all elements of this $coll
419417
* except some of occurrences of elements that also appear in `that`.
420418
* If an element value `x` appears
@@ -438,8 +436,6 @@ trait GenSeqLike[+A, +Repr] extends Any with GenIterableLike[A, Repr] with Equal
438436
*
439437
* @param that the sequence of elements to intersect with.
440438
* @tparam B the element type of the returned $coll.
441-
* @tparam That $thatinfo
442-
* @param bf $bfinfo
443439
* @return a new collection of type `That` which contains all elements of this $coll
444440
* which also appear in `that`.
445441
* If an element value `x` appears

src/library/scala/collection/GenTraversableLike.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,27 +289,27 @@ trait GenTraversableLike[+A, +Repr] extends Any with GenTraversableOnce[A] with
289289

290290
/** Selects all elements of this $coll which satisfy a predicate.
291291
*
292-
* @param p the predicate used to test elements.
292+
* @param pred the predicate used to test elements.
293293
* @return a new $coll consisting of all elements of this $coll that satisfy the given
294294
* predicate `p`. Their order may not be preserved.
295295
*/
296296
def filter(pred: A => Boolean): Repr
297297

298298
/** Selects all elements of this $coll which do not satisfy a predicate.
299299
*
300-
* @param p the predicate used to test elements.
300+
* @param pred the predicate used to test elements.
301301
* @return a new $coll consisting of all elements of this $coll that do not satisfy the given
302302
* predicate `p`. Their order may not be preserved.
303303
*/
304304
def filterNot(pred: A => Boolean): Repr
305305

306306
/** Partitions this $coll in two ${coll}s according to a predicate.
307307
*
308-
* @param p the predicate on which to partition.
309-
* @return a pair of ${coll}s: the first $coll consists of all elements that
310-
* satisfy the predicate `p` and the second $coll consists of all elements
311-
* that don't. The relative order of the elements in the resulting ${coll}s
312-
* may not be preserved.
308+
* @param pred the predicate on which to partition.
309+
* @return a pair of ${coll}s: the first $coll consists of all elements that
310+
* satisfy the predicate `p` and the second $coll consists of all elements
311+
* that don't. The relative order of the elements in the resulting ${coll}s
312+
* may not be preserved.
313313
*/
314314
def partition(pred: A => Boolean): (Repr, Repr)
315315

@@ -354,8 +354,8 @@ trait GenTraversableLike[+A, +Repr] extends Any with GenTraversableOnce[A] with
354354
* }}}
355355
* $orderDependent
356356
*
357-
* @param from the lowest index to include from this $coll.
358-
* @param until the lowest index to EXCLUDE from this $coll.
357+
* @param unc_from the lowest index to include from this $coll.
358+
* @param unc_until the lowest index to EXCLUDE from this $coll.
359359
* @return a $coll containing the elements greater than or equal to
360360
* index `from` extending up to (but not including) index `until`
361361
* of this $coll.
@@ -375,7 +375,7 @@ trait GenTraversableLike[+A, +Repr] extends Any with GenTraversableOnce[A] with
375375

376376
/** Takes longest prefix of elements that satisfy a predicate.
377377
* $orderDependent
378-
* @param p The predicate used to test elements.
378+
* @param pred The predicate used to test elements.
379379
* @return the longest prefix of this $coll whose elements all satisfy
380380
* the predicate `p`.
381381
*/
@@ -388,15 +388,15 @@ trait GenTraversableLike[+A, +Repr] extends Any with GenTraversableOnce[A] with
388388
* predicate `p` does not cause any side-effects.
389389
* $orderDependent
390390
*
391-
* @param p the test predicate
391+
* @param pred the test predicate
392392
* @return a pair consisting of the longest prefix of this $coll whose
393393
* elements all satisfy `p`, and the rest of this $coll.
394394
*/
395395
def span(pred: A => Boolean): (Repr, Repr)
396396

397397
/** Drops longest prefix of elements that satisfy a predicate.
398398
* $orderDependent
399-
* @param p The predicate used to test elements.
399+
* @param pred The predicate used to test elements.
400400
* @return the longest suffix of this $coll whose first element
401401
* does not satisfy the predicate `p`.
402402
*/

0 commit comments

Comments
 (0)