Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/library-aux/scala/Any.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ abstract class Any {
*/
def equals(that: Any): Boolean

/** Calculate a hash code value for the object.
/** Calculates a hash code value for the object.
*
* The default hashing algorithm is platform dependent.
*
Expand Down Expand Up @@ -82,15 +82,15 @@ abstract class Any {
*/
final def getClass(): Class[_] = sys.error("getClass")

/** Test two objects for equality.
/** Tests two objects for equality.
* The expression `x == that` is equivalent to `if (x eq null) that eq null else x.equals(that)`.
*
* @param that the object to compare against this object for equality.
* @return `true` if the receiver object is equivalent to the argument; `false` otherwise.
*/
final def ==(that: Any): Boolean = this equals that

/** Test two objects for inequality.
/** Tests two objects for inequality.
*
* @param that the object to compare against this object for equality.
* @return `true` if !(this == that), false otherwise.
Expand All @@ -109,28 +109,28 @@ abstract class Any {
*/
final def ## : Int = sys.error("##")

/** Test whether the dynamic type of the receiver object has the same erasure as `T0`.
/** Tests whether the dynamic type of the receiver object has the same erasure as `T0`.
*
* Depending on what `T0` is, the test is done in one of the below ways:
*
* - `T0` is a non-parameterized class type, e.g. `BigDecimal`: this method returns `true` if
* the value of the receiver object is a `BigDecimal` or a subtype of `BigDecimal`.
* - `T0` is a parameterized class type, e.g. `List[Int]`: this method returns `true` if
* the value of the receiver object is some `List[X]` for any `X`.
* For example, `List(1, 2, 3).isInstanceOf[List[String]]` will return true.
* For example, `List(1, 2, 3).isInstanceOf[List[String]]` will return `true`.
* - `T0` is some singleton type `x.type` or literal `x`: this method returns `this.eq(x)`.
* For example, `x.isInstanceOf[1]` is equivalent to `x.eq(1)`
* - `T0` is an intersection `X with Y` or `X & Y: this method is equivalent to `x.isInstanceOf[X] && x.isInstanceOf[Y]`
* - `T0` is an intersection `X with Y` or `X & Y`: this method is equivalent to `x.isInstanceOf[X] && x.isInstanceOf[Y]`
* - `T0` is a union `X | Y`: this method is equivalent to `x.isInstanceOf[X] || x.isInstanceOf[Y]`
* - `T0` is a type parameter or an abstract type member: this method is equivalent
* to `isInstanceOf[U]` where `U` is `T0`'s upper bound, `Any` if `T0` is unbounded.
* For example, `x.isInstanceOf[A]` where `A` is an unbounded type parameter
* will return true for any value of `x`.
* will return `true` for any value of `x`.
*
* This is exactly equivalent to the type pattern `_: T0`
* This is exactly equivalent to the type pattern `_: T0`.
*
* @note due to the unexpectedness of `List(1, 2, 3).isInstanceOf[List[String]]` returning true and
* `x.isInstanceOf[A]` where `A` is a type parameter or abstract member returning true,
* @note due to the unexpectedness of `List(1, 2, 3).isInstanceOf[List[String]]` returning `true` and
* `x.isInstanceOf[A]` where `A` is a type parameter or abstract member returning `true`,
* these forms issue a warning.
*
* @return `true` if the receiver object is an instance of erasure of type `T0`; `false` otherwise.
Expand Down
20 changes: 10 additions & 10 deletions src/library-aux/scala/AnyRef.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ trait AnyRef extends Any {
*/
def equals(that: Any): Boolean = this eq that

/** The hashCode method for reference types. See hashCode in [[scala.Any]].
/** The hashCode method for reference types. See `hashCode` in [[scala.Any]].
*
* @return the hash code value for this object.
*/
def hashCode: Int = sys.error("hashCode")

/** Creates a String representation of this object. The default
/** Creates a `String` representation of this object. The default
* representation is platform dependent. On the java platform it
* is the concatenation of the class name, "@", and the object's
* hashcode in hexadecimal.
*
* @return a String representation of the object.
* @return a `String` representation of the object.
*/
def toString: String = sys.error("toString")

Expand Down Expand Up @@ -84,11 +84,11 @@ trait AnyRef extends Any {
if (this eq null) that.asInstanceOf[AnyRef] eq null
else this equals that

/** Create a copy of the receiver object.
/** Creates a copy of the receiver object.
*
* The default implementation of the `clone` method is platform dependent.
*
* @note not specified by SLS as a member of AnyRef
* @note not specified by SLS as a member of `AnyRef`
* @return a copy of the receiver object.
*/
protected def clone(): AnyRef
Expand All @@ -100,29 +100,29 @@ trait AnyRef extends Any {
* well as the interaction between `finalize` and non-local returns
* and exceptions, are all platform dependent.
*
* @note not specified by SLS as a member of AnyRef
* @note not specified by SLS as a member of `AnyRef`
*/
protected def finalize(): Unit

/** Wakes up a single thread that is waiting on the receiver object's monitor.
*
* @note not specified by SLS as a member of AnyRef
* @note not specified by SLS as a member of `AnyRef`
*/
final def notify(): Unit

/** Wakes up all threads that are waiting on the receiver object's monitor.
*
* @note not specified by SLS as a member of AnyRef
* @note not specified by SLS as a member of `AnyRef`
*/
final def notifyAll(): Unit

/** See [[https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--]].
*
* @note not specified by SLS as a member of AnyRef
* @note not specified by SLS as a member of `AnyRef`
*/
final def wait (): Unit

/** See [[https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-]]
/** See [[https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-]].
*
* @param timeout the maximum time to wait in milliseconds.
* @param nanos additional time, in nanoseconds range 0-999999.
Expand Down
4 changes: 2 additions & 2 deletions src/library-aux/scala/Nothing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package scala
* [[scala.collection.immutable.Nil]] of type `List[Nothing]`. Because lists are covariant in Scala,
* this makes [[scala.collection.immutable.Nil]] an instance of `List[T]`, for any element of type `T`.
*
* Another usage for Nothing is the return type for methods which never return normally.
* One example is method error in [[scala.sys]], which always throws an exception.
* Another usage for `Nothing` is the return type for methods which never return normally.
* One example is method `error` in [[scala.sys]], which always throws an exception.
*/
sealed trait Nothing

52 changes: 26 additions & 26 deletions src/library/scala/Array.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object Array {
val emptyShortArray = new Array[Short](0)
val emptyObjectArray = new Array[Object](0)

/** Provides an implicit conversion from the Array object to a collection Factory */
/** Provides an implicit conversion from the Array object to a collection Factory. */
implicit def toFactory[A : ClassTag](dummy: Array.type): Factory[A, Array[A]] = new ArrayFactory(dummy)
@SerialVersionUID(3L)
private class ArrayFactory[A : ClassTag](dummy: Array.type) extends Factory[A, Array[A]] with Serializable {
Expand All @@ -56,7 +56,7 @@ object Array {
*/
def newBuilder[T](implicit t: ClassTag[T]): ArrayBuilder[T] = ArrayBuilder.make[T](using t)

/** Build an array from the iterable collection.
/** Builds an array from the iterable collection.
*
* {{{
* scala> val a = Array.from(Seq(1, 5))
Expand Down Expand Up @@ -89,7 +89,7 @@ object Array {
}
}

/** Copy one array to another.
/** Copies one array to another.
* Equivalent to Java's
* `System.arraycopy(src, srcPos, dest, destPos, length)`,
* except that this also works for polymorphic and boxed arrays.
Expand All @@ -114,7 +114,7 @@ object Array {
slowcopy(src, srcPos, dest, destPos, length)
}

/** Copy one array to another, truncating or padding with default values (if
/** Copies one array to another, truncating or padding with default values (if
* necessary) so the copy has the specified length.
*
* Equivalent to Java's
Expand All @@ -136,7 +136,7 @@ object Array {
case original: Array[Boolean] => java.util.Arrays.copyOf(original, newLength)
}).asInstanceOf[Array[A]]

/** Copy one array to another, truncating or padding with default values (if
/** Copies one array to another, truncating or padding with default values (if
* necessary) so the copy has the specified length. The new array can have
* a different type than the original one as long as the values are
* assignment-compatible. When copying between primitive and object arrays,
Expand Down Expand Up @@ -174,7 +174,7 @@ object Array {
result
}

/** Returns an array of length 0 */
/** Returns an array of length 0. */
def empty[T: ClassTag]: Array[T] = new Array[T](0)

/** Creates an array with given elements.
Expand Down Expand Up @@ -204,7 +204,7 @@ object Array {
}
}

/** Creates an array of `Boolean` objects */
/** Creates an array of `Boolean` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Boolean, xs: Boolean*): Array[Boolean] = {
val array = new Array[Boolean](xs.length + 1)
Expand All @@ -217,7 +217,7 @@ object Array {
array
}

/** Creates an array of `Byte` objects */
/** Creates an array of `Byte` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Byte, xs: Byte*): Array[Byte] = {
val array = new Array[Byte](xs.length + 1)
Expand All @@ -230,7 +230,7 @@ object Array {
array
}

/** Creates an array of `Short` objects */
/** Creates an array of `Short` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Short, xs: Short*): Array[Short] = {
val array = new Array[Short](xs.length + 1)
Expand All @@ -243,7 +243,7 @@ object Array {
array
}

/** Creates an array of `Char` objects */
/** Creates an array of `Char` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Char, xs: Char*): Array[Char] = {
val array = new Array[Char](xs.length + 1)
Expand All @@ -256,7 +256,7 @@ object Array {
array
}

/** Creates an array of `Int` objects */
/** Creates an array of `Int` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Int, xs: Int*): Array[Int] = {
val array = new Array[Int](xs.length + 1)
Expand All @@ -269,7 +269,7 @@ object Array {
array
}

/** Creates an array of `Long` objects */
/** Creates an array of `Long` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Long, xs: Long*): Array[Long] = {
val array = new Array[Long](xs.length + 1)
Expand All @@ -282,7 +282,7 @@ object Array {
array
}

/** Creates an array of `Float` objects */
/** Creates an array of `Float` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Float, xs: Float*): Array[Float] = {
val array = new Array[Float](xs.length + 1)
Expand All @@ -295,7 +295,7 @@ object Array {
array
}

/** Creates an array of `Double` objects */
/** Creates an array of `Double` objects. */
// Subject to a compiler optimization in Cleanup, see above.
def apply(x: Double, xs: Double*): Array[Double] = {
val array = new Array[Double](xs.length + 1)
Expand All @@ -308,7 +308,7 @@ object Array {
array
}

/** Creates an array of `Unit` objects */
/** Creates an array of `Unit` objects. */
def apply(x: Unit, xs: Unit*): Array[Unit] = {
val array = new Array[Unit](xs.length + 1)
array(0) = x
Expand All @@ -320,23 +320,23 @@ object Array {
array
}

/** Creates array with given dimensions */
/** Creates array with given dimensions. */
def ofDim[T: ClassTag](n1: Int): Array[T] =
new Array[T](n1)
/** Creates a 2-dimensional array */
/** Creates a 2-dimensional array. */
def ofDim[T: ClassTag](n1: Int, n2: Int): Array[Array[T]] = {
val arr: Array[Array[T]] = (new Array[Array[T]](n1): Array[Array[T]])
for (i <- 0 until n1) arr(i) = new Array[T](n2)
arr
// tabulate(n1)(_ => ofDim[T](n2))
}
/** Creates a 3-dimensional array */
/** Creates a 3-dimensional array. */
def ofDim[T: ClassTag](n1: Int, n2: Int, n3: Int): Array[Array[Array[T]]] =
tabulate(n1)(_ => ofDim[T](n2, n3))
/** Creates a 4-dimensional array */
/** Creates a 4-dimensional array. */
def ofDim[T: ClassTag](n1: Int, n2: Int, n3: Int, n4: Int): Array[Array[Array[Array[T]]]] =
tabulate(n1)(_ => ofDim[T](n2, n3, n4))
/** Creates a 5-dimensional array */
/** Creates a 5-dimensional array. */
def ofDim[T: ClassTag](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int): Array[Array[Array[Array[Array[T]]]]] =
tabulate(n1)(_ => ofDim[T](n2, n3, n4, n5))

Expand Down Expand Up @@ -548,7 +548,7 @@ object Array {
}
}

/** Compare two arrays per element.
/** Compares two arrays per element.
*
* A more efficient version of `xs.sameElements(ys)`.
*
Expand All @@ -559,8 +559,8 @@ object Array {
*
* `Array.equals(xs.asInstanceOf[Array[AnyRef]], ys.asInstanceOf[Array[AnyRef]])`
*
* @param xs an array of AnyRef
* @param ys an array of AnyRef
* @param xs an array of `AnyRef`
* @param ys an array of `AnyRef`
* @return true if corresponding elements are equal
*/
def equals(xs: Array[AnyRef], ys: Array[AnyRef]): Boolean =
Expand Down Expand Up @@ -659,7 +659,7 @@ object Array {
*/
final class Array[T](_length: Int) extends java.io.Serializable with java.lang.Cloneable {

/** The length of the array */
/** The length of the array. */
def length: Int = throw new Error()

/** The element at given index.
Expand All @@ -673,7 +673,7 @@ final class Array[T](_length: Int) extends java.io.Serializable with java.lang.C
*/
def apply(i: Int): T = throw new Error()

/** Update the element at given index.
/** Updates the element at given index.
*
* Indices start at `0`; `xs.update(i, x)` replaces the i^th^ element in the array.
* Note the syntax `xs(i) = x` is a shorthand for `xs.update(i, x)`.
Expand All @@ -684,7 +684,7 @@ final class Array[T](_length: Int) extends java.io.Serializable with java.lang.C
*/
def update(i: Int, x: T): Unit = { throw new Error() }

/** Clone the Array.
/** Clones the Array.
*
* @return A clone of the Array.
*/
Expand Down
10 changes: 5 additions & 5 deletions src/library/scala/Console.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ object Console extends AnsiColor {
protected def setErrDirect(err: PrintStream): Unit = errVar.value = err
protected def setInDirect(in: BufferedReader): Unit = inVar.value = in

/** The default output, can be overridden by `withOut`
/** The default output, can be overridden by `withOut`.
* @group io-default
*/
def out: PrintStream = outVar.value
/** The default error, can be overridden by `withErr`
/** The default error, can be overridden by `withErr`.
* @group io-default
*/
def err: PrintStream = errVar.value
/** The default input, can be overridden by `withIn`
/** The default input, can be overridden by `withIn`.
* @group io-default
*/
def in: BufferedReader = inVar.value
Expand Down Expand Up @@ -176,7 +176,7 @@ object Console extends AnsiColor {
def withOut[T](out: OutputStream)(thunk: => T): T =
withOut(new PrintStream(out))(thunk)

/** Set the default error stream for the duration
/** Sets the default error stream for the duration
* of execution of one thunk.
* @example {{{
* withErr(Console.out) { err.println("This goes to default _out_") }
Expand Down Expand Up @@ -241,7 +241,7 @@ object Console extends AnsiColor {

/** Prints an object to `out` using its `toString` method.
*
* @param obj the object to print; may be null.
* @param obj the object to print; may be `null`.
* @group console-output
*/
def print(obj: Any): Unit = {
Expand Down
Loading