diff options
33 files changed, 1100 insertions, 762 deletions
diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala index b9f1ee2317..e8230b8ca4 100644 --- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala +++ b/src/compiler/scala/tools/cmd/gen/AnyVals.scala @@ -33,15 +33,15 @@ trait AnyValReps { def unaryOps = { val ops = List( Op("+", "/**\n" + - " * @return this value, unmodified\n" + + " * Returns this value, unmodified.\n" + " */"), Op("-", "/**\n" + - " * @return the negation of this value\n" + + " * Returns the negation of this value.\n" + " */")) if(isCardinal) Op("~", "/**\n" + - " * @return the bitwise negation of this value\n" + + " * Returns the bitwise negation of this value.\n" + " * @example {{{\n" + " * ~5 == -6\n" + " * // in binary: ~00000101 ==\n" + @@ -55,7 +55,7 @@ trait AnyValReps { if (isCardinal) List( Op("|", "/**\n" + - " * @return the bitwise OR of this value and x\n" + + " * Returns the bitwise OR of this value and `x`.\n" + " * @example {{{\n" + " * (0xf0 | 0xaa) == 0xfa\n" + " * // in binary: 11110000\n" + @@ -65,7 +65,7 @@ trait AnyValReps { " * }}}\n" + " */"), Op("&", "/**\n" + - " * @return the bitwise AND of this value and x\n" + + " * Returns the bitwise AND of this value and `x`.\n" + " * @example {{{\n" + " * (0xf0 & 0xaa) == 0xa0\n" + " * // in binary: 11110000\n" + @@ -75,7 +75,7 @@ trait AnyValReps { " * }}}\n" + " */"), Op("^", "/**\n" + - " * @return the bitwise XOR of this value and x\n" + + " * Returns the bitwise XOR of this value and `x`.\n" + " * @example {{{\n" + " * (0xf0 ^ 0xaa) == 0x5a\n" + " * // in binary: 11110000\n" + @@ -90,13 +90,13 @@ trait AnyValReps { if (isCardinal) List( Op("<<", "/**\n" + - " * @return this value bit-shifted left by the specified number of bits,\n" + + " * Returns this value bit-shifted left by the specified number of bits,\n" + " * filling in the new right bits with zeroes.\n" + " * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}}\n" + " */"), Op(">>>", "/**\n" + - " * @return this value bit-shifted right by the specified number of bits,\n" + + " * Returns this value bit-shifted right by the specified number of bits,\n" + " * filling the new left bits with zeroes.\n" + " * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}}\n" + " * @example {{{\n" + @@ -107,7 +107,7 @@ trait AnyValReps { " */"), Op(">>", "/**\n" + - " * @return this value bit-shifted left by the specified number of bits,\n" + + " * Returns this value bit-shifted left by the specified number of bits,\n" + " * filling in the right bits with the same value as the left-most bit of this.\n" + " * The effect of this is to retain the sign of the value.\n" + " * @example {{{\n" + @@ -119,19 +119,19 @@ trait AnyValReps { else Nil def comparisonOps = List( - Op("==", "/**\n * @return `true` if this value is equal x, `false` otherwise\n */"), - Op("!=", "/**\n * @return `true` if this value is not equal to x, `false` otherwise\n */"), - Op("<", "/**\n * @return `true` if this value is less than x, `false` otherwise\n */"), - Op("<=", "/**\n * @return `true` if this value is less than or equal to x, `false` otherwise\n */"), - Op(">", "/**\n * @return `true` if this value is greater than x, `false` otherwise\n */"), - Op(">=", "/**\n * @return `true` if this value is greater than or equal to x, `false` otherwise\n */")) + Op("==", "/**\n * Returns `true` if this value is equal to x, `false` otherwise.\n */"), + Op("!=", "/**\n * Returns `true` if this value is not equal to x, `false` otherwise.\n */"), + Op("<", "/**\n * Returns `true` if this value is less than x, `false` otherwise.\n */"), + Op("<=", "/**\n * Returns `true` if this value is less than or equal to x, `false` otherwise.\n */"), + Op(">", "/**\n * Returns `true` if this value is greater than x, `false` otherwise.\n */"), + Op(">=", "/**\n * Returns `true` if this value is greater than or equal to x, `false` otherwise.\n */")) def otherOps = List( - Op("+", "/**\n * @return the sum of this value and x\n */"), - Op("-", "/**\n * @return the difference of this value and x\n */"), - Op("*", "/**\n * @return the product of this value and x\n */"), - Op("/", "/**\n * @return the quotient of this value and x\n */"), - Op("%", "/**\n * @return the remainder of the division of this value by x\n */")) + Op("+", "/**\n * Returns the sum of this value and `x`.\n */"), + Op("-", "/**\n * Returns the difference of this value and `x`.\n */"), + Op("*", "/**\n * Returns the product of this value and `x`.\n */"), + Op("/", "/**\n * Returns the quotient of this value and `x`.\n */"), + Op("%", "/**\n * Returns the remainder of the division of this value by `x`.\n */")) // Given two numeric value types S and T , the operation type of S and T is defined as follows: // If both S and T are subrange types then the operation type of S and T is Int. @@ -238,8 +238,8 @@ trait AnyValReps { def classDoc = interpolate(classDocTemplate) def objectDoc = "" def mkImports = "" - def mkClass = assemble("final class", "AnyVal", classLines) + "\n" - def mkObject = assemble("object", "AnyValCompanion", objectLines) + "\n" + def mkClass = assemble("final class", "private", "AnyVal", classLines) + "\n" + def mkObject = assemble("object", "", "AnyValCompanion", objectLines) + "\n" def make() = List[String]( headerTemplate, mkImports, @@ -249,8 +249,8 @@ trait AnyValReps { mkObject ) mkString "" - def assemble(what: String, parent: String, lines: List[String]): String = { - val decl = "%s %s extends %s ".format(what, name, parent) + def assemble(what: String, ctor: String, parent: String, lines: List[String]): String = { + val decl = "%s %s %s extends %s ".format(what, name, ctor, parent) val body = if (lines.isEmpty) "{ }\n\n" else lines map indent mkString ("{\n", "\n", "\n}\n") decl + body diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index 9fcd43ac02..124a7509e8 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -398,11 +398,13 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { else if (bSym.isPackage) makeTemplate(bSym.owner) match { case inPkg: PackageImpl => makePackage(bSym, inPkg) getOrElse (new NoDocTemplateImpl(bSym, inPkg)) + case inNoDocTpl: NoDocTemplateImpl => new NoDocTemplateImpl(bSym, inNoDocTpl) case _ => throw new Error("'" + bSym + "' must be in a package") } else if (templateShouldDocument(bSym)) makeTemplate(bSym.owner) match { case inDTpl: DocTemplateImpl => makeDocTemplate(bSym, inDTpl) + case inNoDocTpl: NoDocTemplateImpl => new NoDocTemplateImpl(bSym, inNoDocTpl) case _ => throw new Error("'" + bSym + "' must be in documentable template") } else diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala index 23bef02bed..0e44933ac6 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala @@ -137,8 +137,8 @@ trait ModelFactoryImplicitSupport { // Members inherited by implicit conversions cannot override actual members memberSyms = memberSyms.filterNot((sym1: Symbol) => - existingMembers.exists(sym2 => sym1.name == sym2.name && - isSameType(toType.memberInfo(sym1), sym.info.memberInfo(sym2)))) + existingMembers.exists(sym2 => sym1.name == sym2.name && + !isDistinguishableFrom(toType.memberInfo(sym1), sym.info.memberInfo(sym2)))) debug(" -> full type: " + toType) if (constraints.length != 0) { @@ -498,4 +498,22 @@ trait ModelFactoryImplicitSupport { (aSym.isMethod || aSym.isGetter || aSym.isSetter) && (aSym.nameString != "getClass") } + + /* To put it very bluntly: checks if you can call implicitly added method with t1 when t2 is already there in the + * class. We suppose the name of the two members coincides + * + * The trick here is that the resultType does not matter - the condition for removal it that paramss have the same + * structure (A => B => C may not override (A, B) => C) and that all the types involved are + * of the implcit conversion's member are subtypes of the parent members' parameters */ + def isDistinguishableFrom(t1: Type, t2: Type): Boolean = + if (t1.paramss.map(_.length) == t2.paramss.map(_.length)) { + for ((t1p, t2p) <- t1.paramss.flatten zip t2.paramss.flatten) + if (!isSubType(t1 memberInfo t1p, t2 memberInfo t2p)) + return true // if on the corresponding parameter you give a type that is in t1 but not in t2 + // example: + // def foo(a: Either[Int, Double]): Int = 3 + // def foo(b: Left[T1]): Int = 6 + // a.foo(Right(4.5d)) prints out 3 :) + false + } else true // the member structure is different foo(3, 5) vs foo(3)(5) }
\ No newline at end of file diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 2d656e02b4..21336c2375 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1066,12 +1066,10 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R // equals. def isUsingWarnableEquals = { val m = receiver.info.member(nme.equals_) - def n = actual.info.member(nme.equals_) - ( (m == Object_equals) - || (m == Any_equals) - || (m.isSynthetic && m.owner.isCase && !n.owner.isCase) - ) + ((m == Object_equals) || (m == Any_equals) || isMethodCaseEquals(m)) } + def isMethodCaseEquals(m: Symbol) = m.isSynthetic && m.owner.isCase + def isCaseEquals = isMethodCaseEquals(receiver.info.member(nme.equals_)) // Whether this == or != is one of those defined in Any/AnyRef or an overload from elsewhere. def isUsingDefaultScalaOp = { val s = fn.symbol @@ -1094,9 +1092,11 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R val msg = alwaysEqual == (name == nme.EQ || name == nme.eq) unit.warning(pos, "comparing "+what+" using `"+name.decode+"' will always yield " + msg) } - def nonSensible(pre: String, alwaysEqual: Boolean) = nonSensibleWarning(pre+"values of types "+typesString, alwaysEqual) + def nonSensiblyEq() = nonSensible("", true) + def nonSensiblyNeq() = nonSensible("", false) + def nonSensiblyNew() = nonSensibleWarning("a fresh object", false) def unrelatedTypes() = { val msg = if (name == nme.EQ || name == nme.eq) @@ -1104,52 +1104,73 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R unit.warning(pos, typesString + " are unrelated: they will most likely " + msg) } - if (nullCount == 2) - nonSensible("", true) // null == null + if (nullCount == 2) // null == null + nonSensiblyEq() else if (nullCount == 1) { if (onSyms(_ exists isPrimitiveValueClass)) // null == 5 - nonSensible("", false) + nonSensiblyNeq() else if (onTrees( _ exists isNew)) // null == new AnyRef - nonSensibleWarning("a fresh object", false) + nonSensiblyNew() } else if (isBoolean(receiver)) { if (!isBoolean(actual) && !isMaybeValue(actual)) // true == 5 - nonSensible("", false) + nonSensiblyNeq() } else if (isUnit(receiver)) { if (isUnit(actual)) // () == () - nonSensible("", true) + nonSensiblyEq() else if (!isUnit(actual) && !isMaybeValue(actual)) // () == "abc" - nonSensible("", false) + nonSensiblyNeq() } else if (isNumeric(receiver)) { if (!isNumeric(actual) && !forMSIL) if (isUnit(actual) || isBoolean(actual) || !isMaybeValue(actual)) // 5 == "abc" - nonSensible("", false) + nonSensiblyNeq() } - else if (isWarnable) { + else if (isWarnable && !isCaseEquals) { if (isNew(qual)) // new X == y - nonSensibleWarning("a fresh object", false) + nonSensiblyNew() else if (isNew(args.head) && (receiver.isEffectivelyFinal || isReferenceOp)) // object X ; X == new Y - nonSensibleWarning("a fresh object", false) + nonSensiblyNew() else if (receiver.isEffectivelyFinal && !(receiver isSubClass actual)) { // object X, Y; X == Y if (isEitherNullable) nonSensible("non-null ", false) else - nonSensible("", false) + nonSensiblyNeq() } } // possibleNumericCount is insufficient or this will warn on e.g. Boolean == j.l.Boolean if (isWarnable && nullCount == 0 && !(isSpecial(receiver) && isSpecial(actual))) { - if (actual isSubClass receiver) () - else if (receiver isSubClass actual) () - // warn only if they have no common supertype below Object - else { + // better to have lubbed and lost + def warnIfLubless(): Unit = { val common = global.lub(List(actual.tpe, receiver.tpe)) if (ObjectClass.tpe <:< common) unrelatedTypes() } + def eitherSubclasses = (actual isSubClass receiver) || (receiver isSubClass actual) + // warn if actual has a case parent that is not same as receiver's; + // if actual is not a case, then warn if no common supertype, as below + if (isCaseEquals) { + def thisCase = receiver.info.member(nme.equals_).owner + actual.info.baseClasses.find(_.isCase) match { + case Some(p) if (p != thisCase) => nonSensible("case class ", false) + case None => + // stronger message on (Some(1) == None) + //if (receiver.isCase && receiver.isEffectivelyFinal && !(receiver isSubClass actual)) nonSensiblyNeq() + //else + // if a class, it must be super to thisCase (and receiver) since not <: thisCase + if (!actual.isTrait && !(receiver isSubClass actual)) nonSensiblyNeq() + else if (!eitherSubclasses) warnIfLubless() + case _ => + } + } + else if (actual isSubClass receiver) () + else if (receiver isSubClass actual) () + // warn only if they have no common supertype below Object + else { + warnIfLubless() + } } case _ => } diff --git a/src/library/scala/Boolean.scala b/src/library/scala/Boolean.scala index 5078e59d28..edb82b33fe 100644 --- a/src/library/scala/Boolean.scala +++ b/src/library/scala/Boolean.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Boolean]] => [[scala.runtime.RichBoolean]] * which provides useful non-primitive operations. */ -final class Boolean extends AnyVal { +final class Boolean private extends AnyVal { /** * Negates a Boolean expression. * @@ -110,7 +110,7 @@ final class Boolean extends AnyVal { override def getClass(): Class[Boolean] = sys.error("stub") } -object Boolean extends AnyValCompanion { +object Boolean extends AnyValCompanion { /** Transform a value type into a boxed reference type. * diff --git a/src/library/scala/Byte.scala b/src/library/scala/Byte.scala index 4e64b68bbc..b5b3d88e3f 100644 --- a/src/library/scala/Byte.scala +++ b/src/library/scala/Byte.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Byte]] => [[scala.runtime.RichByte]] * which provides useful non-primitive operations. */ -final class Byte extends AnyVal { +final class Byte private extends AnyVal { def toByte: Byte = sys.error("stub") def toShort: Short = sys.error("stub") def toChar: Char = sys.error("stub") @@ -27,7 +27,7 @@ final class Byte extends AnyVal { def toDouble: Double = sys.error("stub") /** - * @return the bitwise negation of this value + * Returns the bitwise negation of this value. * @example {{{ * ~5 == -6 * // in binary: ~00000101 == @@ -36,30 +36,30 @@ final class Byte extends AnyVal { */ def unary_~ : Int = sys.error("stub") /** - * @return this value, unmodified + * Returns this value, unmodified. */ def unary_+ : Int = sys.error("stub") /** - * @return the negation of this value + * Returns the negation of this value. */ def unary_- : Int = sys.error("stub") def +(x: String): String = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -70,7 +70,7 @@ final class Byte extends AnyVal { */ def >>>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -81,7 +81,7 @@ final class Byte extends AnyVal { */ def >>>(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -92,7 +92,7 @@ final class Byte extends AnyVal { */ def >>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -104,181 +104,181 @@ final class Byte extends AnyVal { def >>(x: Long): Int = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Double): Boolean = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -289,7 +289,7 @@ final class Byte extends AnyVal { */ def |(x: Byte): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -300,7 +300,7 @@ final class Byte extends AnyVal { */ def |(x: Short): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -311,7 +311,7 @@ final class Byte extends AnyVal { */ def |(x: Char): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -322,7 +322,7 @@ final class Byte extends AnyVal { */ def |(x: Int): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -334,7 +334,7 @@ final class Byte extends AnyVal { def |(x: Long): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -345,7 +345,7 @@ final class Byte extends AnyVal { */ def &(x: Byte): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -356,7 +356,7 @@ final class Byte extends AnyVal { */ def &(x: Short): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -367,7 +367,7 @@ final class Byte extends AnyVal { */ def &(x: Char): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -378,7 +378,7 @@ final class Byte extends AnyVal { */ def &(x: Int): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -390,7 +390,7 @@ final class Byte extends AnyVal { def &(x: Long): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -401,7 +401,7 @@ final class Byte extends AnyVal { */ def ^(x: Byte): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -412,7 +412,7 @@ final class Byte extends AnyVal { */ def ^(x: Short): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -423,7 +423,7 @@ final class Byte extends AnyVal { */ def ^(x: Char): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -434,7 +434,7 @@ final class Byte extends AnyVal { */ def ^(x: Int): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -446,154 +446,154 @@ final class Byte extends AnyVal { def ^(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Byte): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Short): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Char): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Int): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Float): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Double): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Byte): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Short): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Char): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Int): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Long): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Float): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Double): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Byte): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Short): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Char): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Int): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Long): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Float): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Double): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Byte): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Short): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Char): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Int): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Long): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Float): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Double): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Byte): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Short): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Char): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Int): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Long): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Float): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double = sys.error("stub") override def getClass(): Class[Byte] = sys.error("stub") } -object Byte extends AnyValCompanion { +object Byte extends AnyValCompanion { /** The smallest value representable as a Byte. */ final val MinValue = java.lang.Byte.MIN_VALUE diff --git a/src/library/scala/Char.scala b/src/library/scala/Char.scala index 8f770316c1..e0ac9a2550 100644 --- a/src/library/scala/Char.scala +++ b/src/library/scala/Char.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Char]] => [[scala.runtime.RichChar]] * which provides useful non-primitive operations. */ -final class Char extends AnyVal { +final class Char private extends AnyVal { def toByte: Byte = sys.error("stub") def toShort: Short = sys.error("stub") def toChar: Char = sys.error("stub") @@ -27,7 +27,7 @@ final class Char extends AnyVal { def toDouble: Double = sys.error("stub") /** - * @return the bitwise negation of this value + * Returns the bitwise negation of this value. * @example {{{ * ~5 == -6 * // in binary: ~00000101 == @@ -36,30 +36,30 @@ final class Char extends AnyVal { */ def unary_~ : Int = sys.error("stub") /** - * @return this value, unmodified + * Returns this value, unmodified. */ def unary_+ : Int = sys.error("stub") /** - * @return the negation of this value + * Returns the negation of this value. */ def unary_- : Int = sys.error("stub") def +(x: String): String = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -70,7 +70,7 @@ final class Char extends AnyVal { */ def >>>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -81,7 +81,7 @@ final class Char extends AnyVal { */ def >>>(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -92,7 +92,7 @@ final class Char extends AnyVal { */ def >>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -104,181 +104,181 @@ final class Char extends AnyVal { def >>(x: Long): Int = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Double): Boolean = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -289,7 +289,7 @@ final class Char extends AnyVal { */ def |(x: Byte): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -300,7 +300,7 @@ final class Char extends AnyVal { */ def |(x: Short): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -311,7 +311,7 @@ final class Char extends AnyVal { */ def |(x: Char): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -322,7 +322,7 @@ final class Char extends AnyVal { */ def |(x: Int): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -334,7 +334,7 @@ final class Char extends AnyVal { def |(x: Long): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -345,7 +345,7 @@ final class Char extends AnyVal { */ def &(x: Byte): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -356,7 +356,7 @@ final class Char extends AnyVal { */ def &(x: Short): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -367,7 +367,7 @@ final class Char extends AnyVal { */ def &(x: Char): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -378,7 +378,7 @@ final class Char extends AnyVal { */ def &(x: Int): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -390,7 +390,7 @@ final class Char extends AnyVal { def &(x: Long): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -401,7 +401,7 @@ final class Char extends AnyVal { */ def ^(x: Byte): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -412,7 +412,7 @@ final class Char extends AnyVal { */ def ^(x: Short): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -423,7 +423,7 @@ final class Char extends AnyVal { */ def ^(x: Char): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -434,7 +434,7 @@ final class Char extends AnyVal { */ def ^(x: Int): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -446,154 +446,154 @@ final class Char extends AnyVal { def ^(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Byte): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Short): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Char): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Int): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Float): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Double): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Byte): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Short): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Char): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Int): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Long): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Float): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Double): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Byte): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Short): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Char): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Int): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Long): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Float): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Double): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Byte): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Short): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Char): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Int): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Long): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Float): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Double): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Byte): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Short): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Char): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Int): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Long): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Float): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double = sys.error("stub") override def getClass(): Class[Char] = sys.error("stub") } -object Char extends AnyValCompanion { +object Char extends AnyValCompanion { /** The smallest value representable as a Char. */ final val MinValue = java.lang.Character.MIN_VALUE diff --git a/src/library/scala/Double.scala b/src/library/scala/Double.scala index 01414265c4..bb659b963a 100644 --- a/src/library/scala/Double.scala +++ b/src/library/scala/Double.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Double]] => [[scala.runtime.RichDouble]] * which provides useful non-primitive operations. */ -final class Double extends AnyVal { +final class Double private extends AnyVal { def toByte: Byte = sys.error("stub") def toShort: Short = sys.error("stub") def toChar: Char = sys.error("stub") @@ -27,339 +27,339 @@ final class Double extends AnyVal { def toDouble: Double = sys.error("stub") /** - * @return this value, unmodified + * Returns this value, unmodified. */ def unary_+ : Double = sys.error("stub") /** - * @return the negation of this value + * Returns the negation of this value. */ def unary_- : Double = sys.error("stub") def +(x: String): String = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Double): Boolean = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Byte): Double = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Short): Double = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Char): Double = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Int): Double = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Long): Double = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Float): Double = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Double): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Byte): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Short): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Char): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Int): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Long): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Float): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Double): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Byte): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Short): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Char): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Int): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Long): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Float): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Double): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Byte): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Short): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Char): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Int): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Long): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Float): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Double): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Byte): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Short): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Char): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Int): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Long): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Float): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double = sys.error("stub") override def getClass(): Class[Double] = sys.error("stub") } -object Double extends AnyValCompanion { +object Double extends AnyValCompanion { /** The smallest positive value greater than 0.0d which is * representable as a Double. */ diff --git a/src/library/scala/Float.scala b/src/library/scala/Float.scala index ddbbd48bf4..bb03581062 100644 --- a/src/library/scala/Float.scala +++ b/src/library/scala/Float.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Float]] => [[scala.runtime.RichFloat]] * which provides useful non-primitive operations. */ -final class Float extends AnyVal { +final class Float private extends AnyVal { def toByte: Byte = sys.error("stub") def toShort: Short = sys.error("stub") def toChar: Char = sys.error("stub") @@ -27,339 +27,339 @@ final class Float extends AnyVal { def toDouble: Double = sys.error("stub") /** - * @return this value, unmodified + * Returns this value, unmodified. */ def unary_+ : Float = sys.error("stub") /** - * @return the negation of this value + * Returns the negation of this value. */ def unary_- : Float = sys.error("stub") def +(x: String): String = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Double): Boolean = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Byte): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Short): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Char): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Int): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Long): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Float): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Double): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Byte): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Short): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Char): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Int): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Long): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Float): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Double): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Byte): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Short): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Char): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Int): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Long): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Float): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Double): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Byte): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Short): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Char): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Int): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Long): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Float): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Double): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Byte): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Short): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Char): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Int): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Long): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Float): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double = sys.error("stub") override def getClass(): Class[Float] = sys.error("stub") } -object Float extends AnyValCompanion { +object Float extends AnyValCompanion { /** The smallest positive value greater than 0.0f which is * representable as a Float. */ diff --git a/src/library/scala/Int.scala b/src/library/scala/Int.scala index ef82b1f979..d5d7ef011d 100644 --- a/src/library/scala/Int.scala +++ b/src/library/scala/Int.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Int]] => [[scala.runtime.RichInt]] * which provides useful non-primitive operations. */ -final class Int extends AnyVal { +final class Int private extends AnyVal { def toByte: Byte = sys.error("stub") def toShort: Short = sys.error("stub") def toChar: Char = sys.error("stub") @@ -27,7 +27,7 @@ final class Int extends AnyVal { def toDouble: Double = sys.error("stub") /** - * @return the bitwise negation of this value + * Returns the bitwise negation of this value. * @example {{{ * ~5 == -6 * // in binary: ~00000101 == @@ -36,30 +36,30 @@ final class Int extends AnyVal { */ def unary_~ : Int = sys.error("stub") /** - * @return this value, unmodified + * Returns this value, unmodified. */ def unary_+ : Int = sys.error("stub") /** - * @return the negation of this value + * Returns the negation of this value. */ def unary_- : Int = sys.error("stub") def +(x: String): String = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -70,7 +70,7 @@ final class Int extends AnyVal { */ def >>>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -81,7 +81,7 @@ final class Int extends AnyVal { */ def >>>(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -92,7 +92,7 @@ final class Int extends AnyVal { */ def >>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -104,181 +104,181 @@ final class Int extends AnyVal { def >>(x: Long): Int = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Double): Boolean = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -289,7 +289,7 @@ final class Int extends AnyVal { */ def |(x: Byte): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -300,7 +300,7 @@ final class Int extends AnyVal { */ def |(x: Short): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -311,7 +311,7 @@ final class Int extends AnyVal { */ def |(x: Char): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -322,7 +322,7 @@ final class Int extends AnyVal { */ def |(x: Int): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -334,7 +334,7 @@ final class Int extends AnyVal { def |(x: Long): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -345,7 +345,7 @@ final class Int extends AnyVal { */ def &(x: Byte): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -356,7 +356,7 @@ final class Int extends AnyVal { */ def &(x: Short): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -367,7 +367,7 @@ final class Int extends AnyVal { */ def &(x: Char): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -378,7 +378,7 @@ final class Int extends AnyVal { */ def &(x: Int): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -390,7 +390,7 @@ final class Int extends AnyVal { def &(x: Long): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -401,7 +401,7 @@ final class Int extends AnyVal { */ def ^(x: Byte): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -412,7 +412,7 @@ final class Int extends AnyVal { */ def ^(x: Short): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -423,7 +423,7 @@ final class Int extends AnyVal { */ def ^(x: Char): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -434,7 +434,7 @@ final class Int extends AnyVal { */ def ^(x: Int): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -446,154 +446,154 @@ final class Int extends AnyVal { def ^(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Byte): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Short): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Char): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Int): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Float): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Double): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Byte): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Short): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Char): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Int): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Long): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Float): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Double): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Byte): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Short): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Char): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Int): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Long): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Float): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Double): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Byte): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Short): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Char): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Int): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Long): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Float): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Double): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Byte): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Short): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Char): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Int): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Long): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Float): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double = sys.error("stub") override def getClass(): Class[Int] = sys.error("stub") } -object Int extends AnyValCompanion { +object Int extends AnyValCompanion { /** The smallest value representable as a Int. */ final val MinValue = java.lang.Integer.MIN_VALUE diff --git a/src/library/scala/Long.scala b/src/library/scala/Long.scala index d57fe8b379..85131b4f54 100644 --- a/src/library/scala/Long.scala +++ b/src/library/scala/Long.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Long]] => [[scala.runtime.RichLong]] * which provides useful non-primitive operations. */ -final class Long extends AnyVal { +final class Long private extends AnyVal { def toByte: Byte = sys.error("stub") def toShort: Short = sys.error("stub") def toChar: Char = sys.error("stub") @@ -27,7 +27,7 @@ final class Long extends AnyVal { def toDouble: Double = sys.error("stub") /** - * @return the bitwise negation of this value + * Returns the bitwise negation of this value. * @example {{{ * ~5 == -6 * // in binary: ~00000101 == @@ -36,30 +36,30 @@ final class Long extends AnyVal { */ def unary_~ : Long = sys.error("stub") /** - * @return this value, unmodified + * Returns this value, unmodified. */ def unary_+ : Long = sys.error("stub") /** - * @return the negation of this value + * Returns the negation of this value. */ def unary_- : Long = sys.error("stub") def +(x: String): String = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Int): Long = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Long): Long = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -70,7 +70,7 @@ final class Long extends AnyVal { */ def >>>(x: Int): Long = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -81,7 +81,7 @@ final class Long extends AnyVal { */ def >>>(x: Long): Long = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -92,7 +92,7 @@ final class Long extends AnyVal { */ def >>(x: Int): Long = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -104,181 +104,181 @@ final class Long extends AnyVal { def >>(x: Long): Long = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Double): Boolean = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -289,7 +289,7 @@ final class Long extends AnyVal { */ def |(x: Byte): Long = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -300,7 +300,7 @@ final class Long extends AnyVal { */ def |(x: Short): Long = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -311,7 +311,7 @@ final class Long extends AnyVal { */ def |(x: Char): Long = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -322,7 +322,7 @@ final class Long extends AnyVal { */ def |(x: Int): Long = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -334,7 +334,7 @@ final class Long extends AnyVal { def |(x: Long): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -345,7 +345,7 @@ final class Long extends AnyVal { */ def &(x: Byte): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -356,7 +356,7 @@ final class Long extends AnyVal { */ def &(x: Short): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -367,7 +367,7 @@ final class Long extends AnyVal { */ def &(x: Char): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -378,7 +378,7 @@ final class Long extends AnyVal { */ def &(x: Int): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -390,7 +390,7 @@ final class Long extends AnyVal { def &(x: Long): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -401,7 +401,7 @@ final class Long extends AnyVal { */ def ^(x: Byte): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -412,7 +412,7 @@ final class Long extends AnyVal { */ def ^(x: Short): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -423,7 +423,7 @@ final class Long extends AnyVal { */ def ^(x: Char): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -434,7 +434,7 @@ final class Long extends AnyVal { */ def ^(x: Int): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -446,154 +446,154 @@ final class Long extends AnyVal { def ^(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Byte): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Short): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Char): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Int): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Float): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Double): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Byte): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Short): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Char): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Int): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Long): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Float): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Double): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Byte): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Short): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Char): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Int): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Long): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Float): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Double): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Byte): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Short): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Char): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Int): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Long): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Float): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Double): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Byte): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Short): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Char): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Int): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Long): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Float): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double = sys.error("stub") override def getClass(): Class[Long] = sys.error("stub") } -object Long extends AnyValCompanion { +object Long extends AnyValCompanion { /** The smallest value representable as a Long. */ final val MinValue = java.lang.Long.MIN_VALUE diff --git a/src/library/scala/Short.scala b/src/library/scala/Short.scala index 707f9bc4eb..1060a9db16 100644 --- a/src/library/scala/Short.scala +++ b/src/library/scala/Short.scala @@ -17,7 +17,7 @@ package scala * There is an implicit conversion from [[scala.Short]] => [[scala.runtime.RichShort]] * which provides useful non-primitive operations. */ -final class Short extends AnyVal { +final class Short private extends AnyVal { def toByte: Byte = sys.error("stub") def toShort: Short = sys.error("stub") def toChar: Char = sys.error("stub") @@ -27,7 +27,7 @@ final class Short extends AnyVal { def toDouble: Double = sys.error("stub") /** - * @return the bitwise negation of this value + * Returns the bitwise negation of this value. * @example {{{ * ~5 == -6 * // in binary: ~00000101 == @@ -36,30 +36,30 @@ final class Short extends AnyVal { */ def unary_~ : Int = sys.error("stub") /** - * @return this value, unmodified + * Returns this value, unmodified. */ def unary_+ : Int = sys.error("stub") /** - * @return the negation of this value + * Returns the negation of this value. */ def unary_- : Int = sys.error("stub") def +(x: String): String = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the new right bits with zeroes. * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}} */ def <<(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -70,7 +70,7 @@ final class Short extends AnyVal { */ def >>>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted right by the specified number of bits, + * Returns this value bit-shifted right by the specified number of bits, * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ @@ -81,7 +81,7 @@ final class Short extends AnyVal { */ def >>>(x: Long): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -92,7 +92,7 @@ final class Short extends AnyVal { */ def >>(x: Int): Int = sys.error("stub") /** - * @return this value bit-shifted left by the specified number of bits, + * Returns this value bit-shifted left by the specified number of bits, * filling in the right bits with the same value as the left-most bit of this. * The effect of this is to retain the sign of the value. * @example {{{ @@ -104,181 +104,181 @@ final class Short extends AnyVal { def >>(x: Long): Int = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is equal x, `false` otherwise + * Returns `true` if this value is equal to x, `false` otherwise. */ def ==(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is not equal to x, `false` otherwise + * Returns `true` if this value is not equal to x, `false` otherwise. */ def !=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than x, `false` otherwise + * Returns `true` if this value is less than x, `false` otherwise. */ def <(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is less than or equal to x, `false` otherwise + * Returns `true` if this value is less than or equal to x, `false` otherwise. */ def <=(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than x, `false` otherwise + * Returns `true` if this value is greater than x, `false` otherwise. */ def >(x: Double): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Byte): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Short): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Char): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Int): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Long): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Float): Boolean = sys.error("stub") /** - * @return `true` if this value is greater than or equal to x, `false` otherwise + * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ def >=(x: Double): Boolean = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -289,7 +289,7 @@ final class Short extends AnyVal { */ def |(x: Byte): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -300,7 +300,7 @@ final class Short extends AnyVal { */ def |(x: Short): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -311,7 +311,7 @@ final class Short extends AnyVal { */ def |(x: Char): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -322,7 +322,7 @@ final class Short extends AnyVal { */ def |(x: Int): Int = sys.error("stub") /** - * @return the bitwise OR of this value and x + * Returns the bitwise OR of this value and `x`. * @example {{{ * (0xf0 | 0xaa) == 0xfa * // in binary: 11110000 @@ -334,7 +334,7 @@ final class Short extends AnyVal { def |(x: Long): Long = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -345,7 +345,7 @@ final class Short extends AnyVal { */ def &(x: Byte): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -356,7 +356,7 @@ final class Short extends AnyVal { */ def &(x: Short): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -367,7 +367,7 @@ final class Short extends AnyVal { */ def &(x: Char): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -378,7 +378,7 @@ final class Short extends AnyVal { */ def &(x: Int): Int = sys.error("stub") /** - * @return the bitwise AND of this value and x + * Returns the bitwise AND of this value and `x`. * @example {{{ * (0xf0 & 0xaa) == 0xa0 * // in binary: 11110000 @@ -390,7 +390,7 @@ final class Short extends AnyVal { def &(x: Long): Long = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -401,7 +401,7 @@ final class Short extends AnyVal { */ def ^(x: Byte): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -412,7 +412,7 @@ final class Short extends AnyVal { */ def ^(x: Short): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -423,7 +423,7 @@ final class Short extends AnyVal { */ def ^(x: Char): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -434,7 +434,7 @@ final class Short extends AnyVal { */ def ^(x: Int): Int = sys.error("stub") /** - * @return the bitwise XOR of this value and x + * Returns the bitwise XOR of this value and `x`. * @example {{{ * (0xf0 ^ 0xaa) == 0x5a * // in binary: 11110000 @@ -446,154 +446,154 @@ final class Short extends AnyVal { def ^(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Byte): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Short): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Char): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Int): Int = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Long): Long = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Float): Float = sys.error("stub") /** - * @return the sum of this value and x + * Returns the sum of this value and `x`. */ def +(x: Double): Double = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Byte): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Short): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Char): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Int): Int = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Long): Long = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Float): Float = sys.error("stub") /** - * @return the difference of this value and x + * Returns the difference of this value and `x`. */ def -(x: Double): Double = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Byte): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Short): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Char): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Int): Int = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Long): Long = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Float): Float = sys.error("stub") /** - * @return the product of this value and x + * Returns the product of this value and `x`. */ def *(x: Double): Double = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Byte): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Short): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Char): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Int): Int = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Long): Long = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Float): Float = sys.error("stub") /** - * @return the quotient of this value and x + * Returns the quotient of this value and `x`. */ def /(x: Double): Double = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Byte): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Short): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Char): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Int): Int = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Long): Long = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Float): Float = sys.error("stub") /** - * @return the remainder of the division of this value by x + * Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double = sys.error("stub") override def getClass(): Class[Short] = sys.error("stub") } -object Short extends AnyValCompanion { +object Short extends AnyValCompanion { /** The smallest value representable as a Short. */ final val MinValue = java.lang.Short.MIN_VALUE diff --git a/src/library/scala/Unit.scala b/src/library/scala/Unit.scala index f6ed0121ab..3da5c083d4 100644 --- a/src/library/scala/Unit.scala +++ b/src/library/scala/Unit.scala @@ -16,11 +16,11 @@ package scala * runtime system. A method with return type `Unit` is analogous to a Java * method which is declared `void`. */ -final class Unit extends AnyVal { +final class Unit private extends AnyVal { override def getClass(): Class[Unit] = sys.error("stub") } -object Unit extends AnyValCompanion { +object Unit extends AnyValCompanion { /** Transform a value type into a boxed reference type. * diff --git a/test/files/neg/t5663-badwarneq.check b/test/files/neg/t5663-badwarneq.check new file mode 100644 index 0000000000..00c2234e9d --- /dev/null +++ b/test/files/neg/t5663-badwarneq.check @@ -0,0 +1,22 @@ +t5663-badwarneq.scala:42: error: comparing case class values of types Some[Int] and None.type using `==' will always yield false + println(new Some(1) == None) // Should complain on type, was: spuriously complains on fresh object + ^ +t5663-badwarneq.scala:43: error: comparing case class values of types Some[Int] and Thing using `==' will always yield false + println(Some(1) == new Thing(1)) // Should complain on type, was: spuriously complains on fresh object + ^ +t5663-badwarneq.scala:51: error: ThingOne and Thingy are unrelated: they will most likely never compare equal + println(t1 == t2) // true, but apparently unrelated, a compromise warning + ^ +t5663-badwarneq.scala:52: error: ThingThree and Thingy are unrelated: they will most likely never compare equal + println(t4 == t2) // true, complains because ThingThree is final and Thingy not a subclass, stronger claim than unrelated + ^ +t5663-badwarneq.scala:55: error: comparing case class values of types ThingTwo and Some[Int] using `==' will always yield false + println(t3 == Some(1)) // false, warn on different cases + ^ +t5663-badwarneq.scala:56: error: comparing values of types ThingOne and Cousin using `==' will always yield false + println(t1 == c) // should warn + ^ +t5663-badwarneq.scala:64: error: comparing case class values of types Simple and SimpleSibling.type using `==' will always yield false + println(new Simple() == SimpleSibling) // like Some(1) == None, but needn't be final case + ^ +7 errors found diff --git a/test/files/neg/t5663-badwarneq.flags b/test/files/neg/t5663-badwarneq.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t5663-badwarneq.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t5663-badwarneq.scala b/test/files/neg/t5663-badwarneq.scala new file mode 100644 index 0000000000..56ec389c03 --- /dev/null +++ b/test/files/neg/t5663-badwarneq.scala @@ -0,0 +1,76 @@ + +// alias +trait Thingy + +class Gramps + +// sibling classes that extend a case class +case class Thing(i: Int) extends Gramps +class ThingOne(x:Int) extends Thing(x) +class ThingTwo(y:Int) extends Thing(y) with Thingy +final class ThingThree(z:Int) extends Thing(z) + +// not case cousin +class Cousin extends Gramps + +class SimpleParent +case class Simple() extends SimpleParent +case object SimpleSibling extends SimpleParent + +/* It's not possible to run partest without -deprecation. + * Since detecting the warnings requires a neg test with + * -Xfatal-warnings, and deprecation terminates the compile, + * we'll just comment out the nasty part. The point was + * just to show there's nothing special about a trait + * that extends a case class, which is only permitted + * (deprecatingly) by omitting the parens. + * +// common ancestor is something else +class AnyThing +case class SomeThing extends AnyThing // deprecation +class OtherThing extends AnyThing + +// how you inherit caseness doesn't matter +trait InThing extends SomeThing +class MyThing extends InThing +*/ + +object Test { + def main(a: Array[String]) { + // nothing to do with Gavin + println(new Some(1) == new Some(1)) // OK, true + println(new Some(1) == None) // Should complain on type, was: spuriously complains on fresh object + println(Some(1) == new Thing(1)) // Should complain on type, was: spuriously complains on fresh object + + val t1 = new ThingOne(11) + val t2: Thingy = new ThingTwo(11) + val t3 = new ThingTwo(11) + val t4 = new ThingThree(11) + val c = new Cousin + + println(t1 == t2) // true, but apparently unrelated, a compromise warning + println(t4 == t2) // true, complains because ThingThree is final and Thingy not a subclass, stronger claim than unrelated + println(t2 == t3) // OK, two Thingy + println(t3 == t2) // ditto with case receiver + println(t3 == Some(1)) // false, warn on different cases + println(t1 == c) // should warn + + // don't warn on fresh cases + println(new ThingOne(11) == t1) // OK, was: two cases not warnable on trunk + println(new ThingTwo(11) == t2) // true, was: spuriously complains on fresh object + println(new ThingOne(11) == t3) // two cases not warnable on trunk + println(new ThingTwo(11) == t3) // ditto + + println(new Simple() == SimpleSibling) // like Some(1) == None, but needn't be final case + + /* + val mine = new MyThing + val some = new SomeThing + val other = new OtherThing + println(mine == some) // OK, two Something + println(some == mine) + println(mine == other) // OK, two Anything? + println(mine == t1) // false + */ + } +} diff --git a/test/files/neg/t5666.check b/test/files/neg/t5666.check new file mode 100644 index 0000000000..1be51d0138 --- /dev/null +++ b/test/files/neg/t5666.check @@ -0,0 +1,37 @@ +t5666.scala:2: error: class Any is abstract; cannot be instantiated + new Any + ^ +t5666.scala:3: error: trait AnyVal is abstract; cannot be instantiated + new AnyVal + ^ +t5666.scala:4: error: Double does not have a constructor + new Double + ^ +t5666.scala:5: error: Float does not have a constructor + new Float + ^ +t5666.scala:6: error: Long does not have a constructor + new Long + ^ +t5666.scala:7: error: Int does not have a constructor + new Int + ^ +t5666.scala:8: error: Char does not have a constructor + new Char + ^ +t5666.scala:9: error: Short does not have a constructor + new Short + ^ +t5666.scala:10: error: Byte does not have a constructor + new Byte + ^ +t5666.scala:11: error: Boolean does not have a constructor + new Boolean + ^ +t5666.scala:12: error: Unit does not have a constructor + new Unit + ^ +t5666.scala:13: error: trait Nothing is abstract; cannot be instantiated + new Nothing + ^ +12 errors found diff --git a/test/files/neg/t5666.scala b/test/files/neg/t5666.scala new file mode 100644 index 0000000000..ffaeaacdaf --- /dev/null +++ b/test/files/neg/t5666.scala @@ -0,0 +1,14 @@ +object t5666 { + new Any + new AnyVal + new Double + new Float + new Long + new Int + new Char + new Short + new Byte + new Boolean + new Unit + new Nothing +}
\ No newline at end of file diff --git a/test/scaladoc/resources/implicits-base-res.scala b/test/scaladoc/resources/implicits-base-res.scala index db7ca4fa51..3e3d0f01a6 100644 --- a/test/scaladoc/resources/implicits-base-res.scala +++ b/test/scaladoc/resources/implicits-base-res.scala @@ -11,23 +11,27 @@ trait MyNumeric[R] * - tests the complete type inference * - the following inherited methods should appear: * {{{ - * def convToGtColonDoubleA: Double // pimpA3: with a constraint that T <: Double - * def convToIntA: Int // pimpA2: with a constraint that T = Int - * def convToManifestA: T // pimpA7: with 2 constraints: T: Manifest and T <: Double - * def convToMyNumericA: T // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope - * def convToNumericA: T // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope - * def convToPimpedA: Bar[Foo[T]] // pimpA5: no constraints - * def convToPimpedA: S // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar - * def convToTraversableOps: T // pimpA7: with 2 constraints: T: Manifest and T <: Double - * // should not be abstract! + * def convToGtColonDoubleA(x: Double) // pimpA3: with a constraint that T <: Double + * def convToIntA(x: Int) // pimpA2: with a constraint that T = Int + * def convToManifestA(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double + * def convToMyNumericA(x: T) // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope + * def convToNumericA(x: T) // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope + * def convToPimpedA(x: Bar[Foo[T]]) // pimpA5: no constraints + * def convToPimpedA(x: S) // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar + * def convToTraversableOps(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double + * // should not be abstract! * }}} */ class A[T] { /** This should prevent the implicitly inherited `def convToPimpedA: T` from `pimpA0` from showing up */ - def convToPimpedA: T = sys.error("Let's check it out!") + def convToPimpedA(x: T): T = sys.error("Let's check it out!") + /** This should check implicit member elimination in the case of subtyping */ + def foo(a: T, b: AnyRef): T } /** Companion object with implicit transformations */ object A { + import language.implicitConversions // according to SIP18 + implicit def pimpA0[V](a: A[V]) = new PimpedA(a) implicit def pimpA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a) implicit def pimpA2(a: A[Int]) = new IntA(a) @@ -36,7 +40,7 @@ object A { implicit def pimpA5[Z](a: A[Z]): PimpedA[Bar[Foo[Z]]] = sys.error("not implemented") implicit def pimpA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a) // TODO: Add H <: Double and see why it crashes for C and D -- context bounds, need to check! - implicit def pimpA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps: H = sys.error("no") } + implicit def pimpA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps(x: H): H = sys.error("no") } } @@ -44,13 +48,13 @@ object A { * - tests the existential type solving * - the following inherited methods should appear: * {{{ - * def convToGtColonDoubleA: Double // pimpA3: no constraints - * def convToManifestA: Double // pimpA7: no constraints - * def convToMyNumericA: Double // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope - * def convToNumericA: Double // pimpA1: no constraintsd - * def convToPimpedA: Bar[Foo[Double]] // pimpA5: no constraints - * def convToTraversableOps: Double // pimpA7: no constraints - * // should not be abstract! + * def convToGtColonDoubleA(x: Double) // pimpA3: no constraints + * def convToManifestA(x: Double) // pimpA7: no constraints + * def convToMyNumericA(x: Double) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope + * def convToNumericA(x: Double) // pimpA1: no constraintsd + * def convToPimpedA(x: Bar[Foo[Double]]) // pimpA5: no constraints + * def convToTraversableOps(x: Double) // pimpA7: no constraints + * // should not be abstract! * }}} */ class B extends A[Double] @@ -61,10 +65,10 @@ object B extends A * - tests asSeenFrom * - the following inherited methods should appear: * {{{ - * def convToIntA: Int // pimpA2: no constraints - * def convToMyNumericA: Int // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope - * def convToNumericA: Int // pimpA1: no constraints - * def convToPimpedA: Bar[Foo[Int]] // pimpA5: no constraints + * def convToIntA(x: Int) // pimpA2: no constraints + * def convToMyNumericA(x: Int) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope + * def convToNumericA(x: Int) // pimpA1: no constraints + * def convToPimpedA(x: Bar[Foo[Int]]) // pimpA5: no constraints * }}} */ class C extends A[Int] @@ -75,9 +79,9 @@ object C extends A * - tests implicit elimination * - the following inherited methods should appear: * {{{ - * def convToMyNumericA: String // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope - * def convToNumericA: String // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope - * def convToPimpedA: Bar[Foo[String]] // pimpA5: no constraints + * def convToMyNumericA(x: String) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope + * def convToNumericA(x: String) // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope + * def convToPimpedA(x: Bar[Foo[String]]) // pimpA5: no constraints * }}} */ class D extends A[String] @@ -90,7 +94,7 @@ object D extends A * - A, B and C should be implicitly converted to this */ class PimpedA[V](a: A[V]) { /** The convToPimpedA: V documentation... */ - def convToPimpedA: V = sys.error("Not implemented") + def convToPimpedA(x: V): V = sys.error("Not implemented") } /** NumericA class <br/> @@ -98,7 +102,7 @@ class PimpedA[V](a: A[V]) { * - A, B and C should be implicitly converted to this */ class NumericA[U: Numeric](a: A[U]) { /** The convToNumericA: U documentation... */ - def convToNumericA: U = implicitly[Numeric[U]].zero + def convToNumericA(x: U): U = implicitly[Numeric[U]].zero } /** IntA class <br/> @@ -106,7 +110,7 @@ class NumericA[U: Numeric](a: A[U]) { * - A and C should be implicitly converted to this */ class IntA(a: A[Int]) { /** The convToIntA: Int documentation... */ - def convToIntA: Int = 0 + def convToIntA(x: Int): Int = 0 } /** GtColonDoubleA class <br/> @@ -114,7 +118,7 @@ class IntA(a: A[Int]) { * - A and B should be implicitly converted to this */ class GtColonDoubleA(a: A[T] forSome { type T <: Double }) { /** The convToGtColonDoubleA: Double documentation... */ - def convToGtColonDoubleA: Double = 0 + def convToGtColonDoubleA(x: Double): Double = 0 } /** MyNumericA class <br/> @@ -122,7 +126,7 @@ class GtColonDoubleA(a: A[T] forSome { type T <: Double }) { * - A should be implicitly converted to this */ class MyNumericA[U: MyNumeric](a: A[U]) { /** The convToMyNumericA: U documentation... */ - def convToMyNumericA: U = sys.error("dunno") + def convToMyNumericA(x: U): U = sys.error("dunno") } /** ManifestA class <br/> @@ -130,7 +134,7 @@ class MyNumericA[U: MyNumeric](a: A[U]) { * - A, B, C, D should be implicitly converted to this */ class ManifestA[W: Manifest](a: A[W]) { /** The convToManifestA: W documentation... */ - def convToManifestA: W = sys.error("dunno") + def convToManifestA(x: W): W = sys.error("dunno") } /** MyTraversableOps class <br/> @@ -138,6 +142,6 @@ class ManifestA[W: Manifest](a: A[W]) { */ trait MyTraversableOps[S] { /** The convToTraversableOps: S documentation... */ - def convToTraversableOps: S + def convToTraversableOps(x: S): S } diff --git a/test/scaladoc/resources/implicits-chaining-res.scala b/test/scaladoc/resources/implicits-chaining-res.scala index b20c8f846c..c005d5fe09 100644 --- a/test/scaladoc/resources/implicits-chaining-res.scala +++ b/test/scaladoc/resources/implicits-chaining-res.scala @@ -3,6 +3,8 @@ */ package scala.test.scaladoc.implicits { + import language.implicitConversions // according to SIP18 + // the classes involved case class Z[U](a: U) case class Intermediate[T, U](t: T, u: U) diff --git a/test/scaladoc/resources/implicits-elimination-res.scala b/test/scaladoc/resources/implicits-elimination-res.scala index 68743aee06..b23667440c 100644 --- a/test/scaladoc/resources/implicits-elimination-res.scala +++ b/test/scaladoc/resources/implicits-elimination-res.scala @@ -2,8 +2,13 @@ * Testing scaladoc implicits elimination */ package scala.test.scaladoc.implicits.elimination { + + import language.implicitConversions // according to SIP18 + /** No conversion, as B doesn't bring any member */ class A class B { class C; trait V; type T; } - object A { implicit def toB(a: A): B = null } + object A { + implicit def toB(a: A): B = null + } } diff --git a/test/scaladoc/resources/implicits-scopes-res.scala b/test/scaladoc/resources/implicits-scopes-res.scala index 4e55c3e388..aaeb43f95b 100644 --- a/test/scaladoc/resources/implicits-scopes-res.scala +++ b/test/scaladoc/resources/implicits-scopes-res.scala @@ -2,6 +2,7 @@ * Testing scaladoc implicit scopes - looking for implicits in the right places */ package scala.test.scaladoc.implicits.scopes +import language.implicitConversions // according to SIP18 // TEST1 - In package object package object test1 { diff --git a/test/scaladoc/resources/implicits-shadowing-res.scala b/test/scaladoc/resources/implicits-shadowing-res.scala new file mode 100644 index 0000000000..c5e9493bf3 --- /dev/null +++ b/test/scaladoc/resources/implicits-shadowing-res.scala @@ -0,0 +1,64 @@ +/** + * Test scaladoc implicits distinguishing -- supress all members by implicit conversion that are shadowed by the + * class' own members + * + * {{{ + * scala> class A { def foo(t: String) = 4 } + * defined class A + * + * scala> class B { def foo(t: Any) = 5 } + * defined class B + * + * scala> implicit def AtoB(a:A) = new B + * AtoB: (a: A)B + * + * scala> val a = new A + * a: A = A@28f553e3 + * + * scala> a.foo("T") + * res1: Int = 4 + * + * scala> a.foo(4) + * res2: Int = 5 + * }}} + */ +package scala.test.scaladoc.implicits.shadowing +import language.implicitConversions // according to SIP18 + +/** conv5, conv8, conv9, conv10, conv11 should be visible */ +class A[T] { + def conv1: AnyRef = ??? + def conv2: T = ??? + def conv3(l: Int): AnyRef = ??? + def conv4(l: AnyRef): AnyRef = ??? + def conv5(l: String): AnyRef = ??? + def conv6(l: AnyRef): AnyRef = ??? + def conv7(l: AnyRef): String = ??? + def conv8(l: String)(m: String): AnyRef = ??? + def conv9(l: AnyRef)(m: AnyRef): AnyRef = ??? + def conv10(l: T): T = ??? + def conv11(l: T): T = ??? +} +/** conv5, conv8, conv9, conv11 should be visible */ +class B extends A[Int] +/** conv5, conv8, conv9, conv10, conv11 should be visible */ +class C extends A[Double] +/** conv5, conv8, conv9, conv10 should be visible */ +class D extends A[AnyRef] + +class Z[T] { + def conv1: AnyRef = ??? + def conv2: T = ??? + def conv3(p: Int): AnyRef = ??? + def conv4(p: String): AnyRef = ??? + def conv5(p: AnyRef): AnyRef = ??? + def conv6(p: AnyRef): String = ??? + def conv7(p: AnyRef): AnyRef = ??? + def conv8(p: String, q: String): AnyRef = ??? + def conv9(p: AnyRef, q: AnyRef): AnyRef = ??? + def conv10(p: Int): T = ??? + def conv11(p: String): T = ??? +} +object A { + implicit def AtoZ[T](a: A[T]) = new Z[T] +} diff --git a/test/disabled/run/implicits-base.check b/test/scaladoc/run/implicits-base.check index 619c56180b..619c56180b 100644 --- a/test/disabled/run/implicits-base.check +++ b/test/scaladoc/run/implicits-base.check diff --git a/test/disabled/run/implicits-base.scala b/test/scaladoc/run/implicits-base.scala index 06d017ed70..06d017ed70 100644 --- a/test/disabled/run/implicits-base.scala +++ b/test/scaladoc/run/implicits-base.scala diff --git a/test/disabled/run/implicits-chaining.check b/test/scaladoc/run/implicits-chaining.check index 619c56180b..619c56180b 100644 --- a/test/disabled/run/implicits-chaining.check +++ b/test/scaladoc/run/implicits-chaining.check diff --git a/test/disabled/run/implicits-chaining.scala b/test/scaladoc/run/implicits-chaining.scala index 858ca9ce61..858ca9ce61 100644 --- a/test/disabled/run/implicits-chaining.scala +++ b/test/scaladoc/run/implicits-chaining.scala diff --git a/test/disabled/run/implicits-elimination.check b/test/scaladoc/run/implicits-elimination.check index 619c56180b..619c56180b 100644 --- a/test/disabled/run/implicits-elimination.check +++ b/test/scaladoc/run/implicits-elimination.check diff --git a/test/disabled/run/implicits-elimination.scala b/test/scaladoc/run/implicits-elimination.scala index ed37b9cd90..ed37b9cd90 100644 --- a/test/disabled/run/implicits-elimination.scala +++ b/test/scaladoc/run/implicits-elimination.scala diff --git a/test/disabled/run/implicits-scopes.check b/test/scaladoc/run/implicits-scopes.check index 619c56180b..619c56180b 100644 --- a/test/disabled/run/implicits-scopes.check +++ b/test/scaladoc/run/implicits-scopes.check diff --git a/test/disabled/run/implicits-scopes.scala b/test/scaladoc/run/implicits-scopes.scala index 7b9e80e148..7b9e80e148 100644 --- a/test/disabled/run/implicits-scopes.scala +++ b/test/scaladoc/run/implicits-scopes.scala diff --git a/test/scaladoc/run/implicits-shadowing.check b/test/scaladoc/run/implicits-shadowing.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/implicits-shadowing.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/implicits-shadowing.scala b/test/scaladoc/run/implicits-shadowing.scala new file mode 100644 index 0000000000..7835223d21 --- /dev/null +++ b/test/scaladoc/run/implicits-shadowing.scala @@ -0,0 +1,70 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + // test a file instead of a piece of code + override def resourceFile = "implicits-shadowing-res.scala" + + // start implicits + def scaladocSettings = "-implicits" + + def testModel(root: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + // SEE THE test/resources/implicits-chaining-res.scala FOR THE EXPLANATION OF WHAT'S CHECKED HERE: + val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._object("shadowing") + var conv: ImplicitConversion = null + +//// class A /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val A = base._class("A") + + conv = A._conversion(base._object("A").qualifiedName + ".AtoZ") + assert(conv.members.length == 5) + conv._member("conv5") + conv._member("conv8") + conv._member("conv9") + conv._member("conv10") + conv._member("conv11") + assert(conv.constraints.length == 0) + +//// class B /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val B = base._class("B") + + conv = B._conversion(base._object("A").qualifiedName + ".AtoZ") + assert(conv.members.length == 4) + conv._member("conv5") + conv._member("conv8") + conv._member("conv9") + conv._member("conv11") + assert(conv.constraints.length == 0) + +//// class C /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val C = base._class("C") + + conv = C._conversion(base._object("A").qualifiedName + ".AtoZ") + assert(conv.members.length == 5) + conv._member("conv5") + conv._member("conv8") + conv._member("conv9") + conv._member("conv10") + conv._member("conv11") + assert(conv.constraints.length == 0) + +//// class D /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val D = base._class("D") + + conv = D._conversion(base._object("A").qualifiedName + ".AtoZ") + assert(conv.members.length == 4) + conv._member("conv5") + conv._member("conv8") + conv._member("conv9") + conv._member("conv10") + assert(conv.constraints.length == 0) + } +}
\ No newline at end of file |