From a7aeddd038bead9cda67a85a922a7988b459ff04 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 26 Jan 2012 06:58:17 -0800 Subject: Fix for recently induced -optimise crasher. "Induced" but not in my estimation "caused". Would like to understand why the enclosed test case crashes under -optimise without this change to AddInterfaces. --- test/files/pos/trait-force-info.flags | 1 + test/files/pos/trait-force-info.scala | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/files/pos/trait-force-info.flags create mode 100644 test/files/pos/trait-force-info.scala (limited to 'test/files/pos') diff --git a/test/files/pos/trait-force-info.flags b/test/files/pos/trait-force-info.flags new file mode 100644 index 0000000000..eb4d19bcb9 --- /dev/null +++ b/test/files/pos/trait-force-info.flags @@ -0,0 +1 @@ +-optimise \ No newline at end of file diff --git a/test/files/pos/trait-force-info.scala b/test/files/pos/trait-force-info.scala new file mode 100644 index 0000000000..e01d225c84 --- /dev/null +++ b/test/files/pos/trait-force-info.scala @@ -0,0 +1,18 @@ +/** This does NOT crash unless it's in the interactive package. + */ + +package scala.tools.nsc +package interactive + +trait MyContextTrees { + val self: Global + val NoContext = self.analyzer.NoContext +} +// +// error: java.lang.AssertionError: assertion failed: trait Contexts.NoContext$ linkedModule: List() +// at scala.Predef$.assert(Predef.scala:160) +// at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.innerSymbol$1(ClassfileParser.scala:1211) +// at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.classSymbol(ClassfileParser.scala:1223) +// at scala.tools.nsc.symtab.classfile.ClassfileParser.classNameToSymbol(ClassfileParser.scala:489) +// at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:757) +// at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:789) -- cgit v1.2.3 From e61eff23df977eeed19bfe253b01b69cce47dfa3 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 27 Jan 2012 16:30:01 -0800 Subject: Unsealed AnyVal. Hacks here and there to allow them to survive at least to erasure. Since nothing is done with them there yet, they inevitably crash and burn a little ways beyond that. --- src/compiler/scala/reflect/internal/TreeInfo.scala | 11 +- .../scala/reflect/internal/TreePrinters.scala | 23 +++-- src/compiler/scala/reflect/internal/Trees.scala | 12 +++ src/compiler/scala/tools/cmd/gen/AnyVals.scala | 6 +- .../scala/tools/nsc/ast/parser/Parsers.scala | 20 ++-- .../tools/nsc/interpreter/MemberHandlers.scala | 2 +- .../tools/nsc/typechecker/ContextErrors.scala | 2 +- .../scala/tools/nsc/typechecker/RefChecks.scala | 10 +- .../scala/tools/nsc/typechecker/Typers.scala | 10 +- src/library/scala/AnyVal.scala | 4 +- src/library/scala/Boolean.scala | 2 +- src/library/scala/Byte.scala | 114 ++++++++++----------- src/library/scala/Char.scala | 114 ++++++++++----------- src/library/scala/Double.scala | 2 +- src/library/scala/Float.scala | 2 +- src/library/scala/Int.scala | 114 ++++++++++----------- src/library/scala/Long.scala | 114 ++++++++++----------- src/library/scala/Short.scala | 114 ++++++++++----------- src/library/scala/Unit.scala | 2 +- test/files/pos/anyval-children.scala | 1 + 20 files changed, 347 insertions(+), 332 deletions(-) create mode 100644 test/files/pos/anyval-children.scala (limited to 'test/files/pos') diff --git a/src/compiler/scala/reflect/internal/TreeInfo.scala b/src/compiler/scala/reflect/internal/TreeInfo.scala index e3ee39d2a0..4380487555 100644 --- a/src/compiler/scala/reflect/internal/TreeInfo.scala +++ b/src/compiler/scala/reflect/internal/TreeInfo.scala @@ -440,15 +440,6 @@ abstract class TreeInfo { EmptyTree } - /** Is the tree Predef, scala.Predef, or _root_.scala.Predef? - */ - def isPredefExpr(t: Tree) = t match { - case Ident(nme.Predef) => true - case Select(Ident(nme.scala_), nme.Predef) => true - case Select(Select(Ident(nme.ROOTPKG), nme.scala_), nme.Predef) => true - case _ => false - } - /** Does list of trees start with a definition of * a class of module with given name (ignoring imports) */ @@ -468,7 +459,7 @@ abstract class TreeInfo { // Top-level definition whose leading imports include Predef. def containsLeadingPredefImport(defs: List[Tree]): Boolean = defs match { case PackageDef(_, defs1) :: _ => containsLeadingPredefImport(defs1) - case Import(expr, _) :: rest => isPredefExpr(expr) || containsLeadingPredefImport(rest) + case Import(expr, _) :: rest => isReferenceToPredef(expr) || containsLeadingPredefImport(rest) case _ => false } diff --git a/src/compiler/scala/reflect/internal/TreePrinters.scala b/src/compiler/scala/reflect/internal/TreePrinters.scala index 3a0717d344..00c20535ba 100644 --- a/src/compiler/scala/reflect/internal/TreePrinters.scala +++ b/src/compiler/scala/reflect/internal/TreePrinters.scala @@ -235,16 +235,21 @@ trait TreePrinters extends api.TreePrinters { self: SymbolTable => case Template(parents, self, body) => val currentOwner1 = currentOwner if (tree.symbol != NoSymbol) currentOwner = tree.symbol.owner - printRow(parents, " with ") - if (!body.isEmpty) { - if (self.name != nme.WILDCARD) { - print(" { ", self.name); printOpt(": ", self.tpt); print(" => ") - } else if (!self.tpt.isEmpty) { - print(" { _ : ", self.tpt, " => ") - } else { - print(" {") + if (parents exists isReferenceToAnyVal) { + print("AnyVal") + } + else { + printRow(parents, " with ") + if (!body.isEmpty) { + if (self.name != nme.WILDCARD) { + print(" { ", self.name); printOpt(": ", self.tpt); print(" => ") + } else if (!self.tpt.isEmpty) { + print(" { _ : ", self.tpt, " => ") + } else { + print(" {") + } + printColumn(body, "", ";", "}") } - printColumn(body, "", ";", "}") } currentOwner = currentOwner1 diff --git a/src/compiler/scala/reflect/internal/Trees.scala b/src/compiler/scala/reflect/internal/Trees.scala index 5bb0c98bfb..7ce087df2f 100644 --- a/src/compiler/scala/reflect/internal/Trees.scala +++ b/src/compiler/scala/reflect/internal/Trees.scala @@ -10,6 +10,18 @@ import Flags._ import api.Modifier trait Trees extends api.Trees { self: SymbolTable => + + // Belongs in TreeInfo but then I can't reach it from TreePrinters. + def isReferenceToScalaMember(t: Tree, Id: Name) = t match { + case Ident(Id) => true + case Select(Ident(nme.scala_), Id) => true + case Select(Select(Ident(nme.ROOTPKG), nme.scala_), Id) => true + case _ => false + } + /** Is the tree Predef, scala.Predef, or _root_.scala.Predef? + */ + def isReferenceToPredef(t: Tree) = isReferenceToScalaMember(t, nme.Predef) + def isReferenceToAnyVal(t: Tree) = isReferenceToScalaMember(t, tpnme.AnyVal) // --- modifiers implementation --------------------------------------- diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala index 8f82c997db..ab4a4a4402 100644 --- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala +++ b/src/compiler/scala/tools/cmd/gen/AnyVals.scala @@ -182,7 +182,7 @@ trait AnyValReps { def classLines: List[String] def objectLines: List[String] def commonClassLines = List( - "def getClass(): Class[@name@]" + "override def getClass(): Class[@name@]" ) def lcname = name.toLowerCase @@ -429,7 +429,7 @@ def &(x: Boolean): Boolean = sys.error("stub") */ def ^(x: Boolean): Boolean = sys.error("stub") -def getClass(): Class[Boolean] = sys.error("stub") +override def getClass(): Class[Boolean] = sys.error("stub") """.trim.lines.toList def objectLines = interpolate(allCompanions).lines.toList @@ -443,7 +443,7 @@ def getClass(): Class[Boolean] = sys.error("stub") */ """ def classLines = List( - """def getClass(): Class[Unit] = sys.error("stub")""" + """override def getClass(): Class[Unit] = sys.error("stub")""" ) def objectLines = interpolate(allCompanions).lines.toList diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index fe6dcc9138..c3e156104f 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -290,11 +290,11 @@ self => inScalaPackage = false currentPackage = "" } - private lazy val anyValNames: Set[Name] = tpnme.ScalaValueNames.toSet + tpnme.AnyVal + private lazy val primitiveNames: Set[Name] = tpnme.ScalaValueNames.toSet - private def inScalaRootPackage = inScalaPackage && currentPackage == "scala" - private def isScalaArray(name: Name) = inScalaRootPackage && name == tpnme.Array - private def isAnyValType(name: Name) = inScalaRootPackage && anyValNames(name) + private def inScalaRootPackage = inScalaPackage && currentPackage == "scala" + private def isScalaArray(name: Name) = inScalaRootPackage && name == tpnme.Array + private def isPrimitiveType(name: Name) = inScalaRootPackage && primitiveNames(name) def parseStartRule: () => Tree @@ -2753,9 +2753,15 @@ self => val tstart0 = if (body.isEmpty && in.lastOffset < tstart) in.lastOffset else tstart atPos(tstart0) { - if (isAnyValType(name)) { - val parent = if (name == tpnme.AnyVal) tpnme.Any else tpnme.AnyVal - Template(List(scalaDot(parent)), self, body) + if (isPrimitiveType(name)) { + Template(List(scalaDot(tpnme.AnyVal)), self, body) + } + else if (parents0 exists isReferenceToAnyVal) { + // TODO - enforce @inline annotation, and no other parents + Template(parents0, self, body) + } + else if (name == tpnme.AnyVal) { + Template(List(scalaDot(tpnme.Any)), self, body) } else { val parents = ( diff --git a/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala b/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala index c742ab89c0..37dd032135 100644 --- a/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala +++ b/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala @@ -182,7 +182,7 @@ trait MemberHandlers { // TODO: Need to track these specially to honor Predef masking attempts, // because they must be the leading imports in the code generated for each // line. We can use the same machinery as Contexts now, anyway. - def isPredefImport = treeInfo.isPredefExpr(expr) + def isPredefImport = isReferenceToPredef(expr) // wildcard imports, e.g. import foo._ private def selectorWild = selectors filter (_.name == nme.USCOREkw) diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index 6ee09d064f..ed18e2ead5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -534,7 +534,7 @@ trait ContextErrors { NormalTypeError(parent, "illegal inheritance from final "+mixin) def ParentSealedInheritanceError(parent: Tree, psym: Symbol) = - NormalTypeError(parent, "illegal inheritance from sealed " + psym + ": " + context.unit.source.file.canonicalPath + " != " + psym.sourceFile.canonicalPath) + NormalTypeError(parent, "illegal inheritance from sealed " + psym)// + ": " + context.unit.source.file.canonicalPath + " != " + psym.sourceFile.canonicalPath) def ParentSelfTypeConformanceError(parent: Tree, selfType: Type) = NormalTypeError(parent, diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index a99d09173e..d492ba3662 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -685,10 +685,12 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R unit.error(clazz.pos, abstractErrorMessage) } else if (clazz.isTrait) { // prevent abstract methods in interfaces that override final members in Object; see #4431 - for (decl <- clazz.info.decls.iterator) { - val overridden = decl.overriddenSymbol(ObjectClass) - if (overridden.isFinal) - unit.error(decl.pos, "trait cannot redefine final method from class AnyRef") + if (!(clazz isSubClass AnyValClass)) { + for (decl <- clazz.info.decls.iterator) { + val overridden = decl.overriddenSymbol(ObjectClass) + if (overridden.isFinal) + unit.error(decl.pos, "trait cannot redefine final method from class AnyRef") + } } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 770b55d6ab..f2aa1fcae4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1336,13 +1336,9 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { if (psym.isFinal) pending += ParentFinalInheritanceError(parent, psym) - if (psym.isSealed && !phase.erasedTypes) { - // AnyVal is sealed, but we have to let the value classes through manually - if (context.unit.source.file == psym.sourceFile || isValueClass(context.owner)) - psym addChild context.owner - else - pending += ParentSealedInheritanceError(parent, psym) - } + if (psym.isSealed && !phase.erasedTypes) + pending += ParentSealedInheritanceError(parent, psym) + if (!(selfType <:< parent.tpe.typeOfThis) && !phase.erasedTypes && !context.owner.isSynthetic && // don't check synthetic concrete classes for virtuals (part of DEVIRTUALIZE) diff --git a/src/library/scala/AnyVal.scala b/src/library/scala/AnyVal.scala index cd2c04dbd8..53d7288ab2 100644 --- a/src/library/scala/AnyVal.scala +++ b/src/library/scala/AnyVal.scala @@ -25,4 +25,6 @@ package scala * The ''integer types'' include the subrange types as well as [[scala.Int]] and [[scala.Long]]. * The ''floating point types'' are [[scala.Float]] and [[scala.Double]]. */ -sealed trait AnyVal +trait AnyVal { + def getClass(): Class[_ <: AnyVal] = ??? +} diff --git a/src/library/scala/Boolean.scala b/src/library/scala/Boolean.scala index 0adcde3aba..5078e59d28 100644 --- a/src/library/scala/Boolean.scala +++ b/src/library/scala/Boolean.scala @@ -107,7 +107,7 @@ final class Boolean extends AnyVal { */ def ^(x: Boolean): Boolean = sys.error("stub") - def getClass(): Class[Boolean] = sys.error("stub") + override def getClass(): Class[Boolean] = sys.error("stub") } object Boolean extends AnyValCompanion { diff --git a/src/library/scala/Byte.scala b/src/library/scala/Byte.scala index 4923cc9786..beff5ce208 100644 --- a/src/library/scala/Byte.scala +++ b/src/library/scala/Byte.scala @@ -30,7 +30,7 @@ final class Byte extends AnyVal { * @return the bitwise negation of this value * @example {{{ * ~5 == -6 - * // in binary: ~00000101 == + * // in binary: ~00000101 == * // 11111010 * }}} */ @@ -60,22 +60,22 @@ final class Byte extends AnyVal { def <<(x: Long): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ def >>>(x: Int): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ @@ -85,8 +85,8 @@ final class Byte extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -96,8 +96,8 @@ final class Byte extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -281,9 +281,9 @@ final class Byte extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -292,9 +292,9 @@ final class Byte extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -303,9 +303,9 @@ final class Byte extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -314,9 +314,9 @@ final class Byte extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -325,9 +325,9 @@ final class Byte extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -337,9 +337,9 @@ final class Byte extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -348,9 +348,9 @@ final class Byte extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -359,9 +359,9 @@ final class Byte extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -370,9 +370,9 @@ final class Byte extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -381,9 +381,9 @@ final class Byte extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -393,9 +393,9 @@ final class Byte extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -404,9 +404,9 @@ final class Byte extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -415,9 +415,9 @@ final class Byte extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -426,9 +426,9 @@ final class Byte extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -437,9 +437,9 @@ final class Byte extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -590,7 +590,7 @@ final class Byte extends AnyVal { */ def %(x: Double): Double = sys.error("stub") - def getClass(): Class[Byte] = sys.error("stub") + override def getClass(): Class[Byte] = sys.error("stub") } object Byte extends AnyValCompanion { diff --git a/src/library/scala/Char.scala b/src/library/scala/Char.scala index b4e6445899..dade572396 100644 --- a/src/library/scala/Char.scala +++ b/src/library/scala/Char.scala @@ -30,7 +30,7 @@ final class Char extends AnyVal { * @return the bitwise negation of this value * @example {{{ * ~5 == -6 - * // in binary: ~00000101 == + * // in binary: ~00000101 == * // 11111010 * }}} */ @@ -60,22 +60,22 @@ final class Char extends AnyVal { def <<(x: Long): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ def >>>(x: Int): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ @@ -85,8 +85,8 @@ final class Char extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -96,8 +96,8 @@ final class Char extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -281,9 +281,9 @@ final class Char extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -292,9 +292,9 @@ final class Char extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -303,9 +303,9 @@ final class Char extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -314,9 +314,9 @@ final class Char extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -325,9 +325,9 @@ final class Char extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -337,9 +337,9 @@ final class Char extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -348,9 +348,9 @@ final class Char extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -359,9 +359,9 @@ final class Char extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -370,9 +370,9 @@ final class Char extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -381,9 +381,9 @@ final class Char extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -393,9 +393,9 @@ final class Char extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -404,9 +404,9 @@ final class Char extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -415,9 +415,9 @@ final class Char extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -426,9 +426,9 @@ final class Char extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -437,9 +437,9 @@ final class Char extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -590,7 +590,7 @@ final class Char extends AnyVal { */ def %(x: Double): Double = sys.error("stub") - def getClass(): Class[Char] = sys.error("stub") + override def getClass(): Class[Char] = sys.error("stub") } object Char extends AnyValCompanion { diff --git a/src/library/scala/Double.scala b/src/library/scala/Double.scala index 68a1a01299..01414265c4 100644 --- a/src/library/scala/Double.scala +++ b/src/library/scala/Double.scala @@ -356,7 +356,7 @@ final class Double extends AnyVal { */ def %(x: Double): Double = sys.error("stub") - def getClass(): Class[Double] = sys.error("stub") + override def getClass(): Class[Double] = sys.error("stub") } object Double extends AnyValCompanion { diff --git a/src/library/scala/Float.scala b/src/library/scala/Float.scala index 709d73d408..ff5b3cb112 100644 --- a/src/library/scala/Float.scala +++ b/src/library/scala/Float.scala @@ -356,7 +356,7 @@ final class Float extends AnyVal { */ def %(x: Double): Double = sys.error("stub") - def getClass(): Class[Float] = sys.error("stub") + override def getClass(): Class[Float] = sys.error("stub") } object Float extends AnyValCompanion { diff --git a/src/library/scala/Int.scala b/src/library/scala/Int.scala index 519a0486ac..6b7debf2df 100644 --- a/src/library/scala/Int.scala +++ b/src/library/scala/Int.scala @@ -30,7 +30,7 @@ final class Int extends AnyVal { * @return the bitwise negation of this value * @example {{{ * ~5 == -6 - * // in binary: ~00000101 == + * // in binary: ~00000101 == * // 11111010 * }}} */ @@ -60,22 +60,22 @@ final class Int extends AnyVal { def <<(x: Long): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ def >>>(x: Int): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ @@ -85,8 +85,8 @@ final class Int extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -96,8 +96,8 @@ final class Int extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -281,9 +281,9 @@ final class Int extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -292,9 +292,9 @@ final class Int extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -303,9 +303,9 @@ final class Int extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -314,9 +314,9 @@ final class Int extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -325,9 +325,9 @@ final class Int extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -337,9 +337,9 @@ final class Int extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -348,9 +348,9 @@ final class Int extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -359,9 +359,9 @@ final class Int extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -370,9 +370,9 @@ final class Int extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -381,9 +381,9 @@ final class Int extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -393,9 +393,9 @@ final class Int extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -404,9 +404,9 @@ final class Int extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -415,9 +415,9 @@ final class Int extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -426,9 +426,9 @@ final class Int extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -437,9 +437,9 @@ final class Int extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -590,7 +590,7 @@ final class Int extends AnyVal { */ def %(x: Double): Double = sys.error("stub") - def getClass(): Class[Int] = sys.error("stub") + override def getClass(): Class[Int] = sys.error("stub") } object Int extends AnyValCompanion { diff --git a/src/library/scala/Long.scala b/src/library/scala/Long.scala index 9c7a803f08..e734c92112 100644 --- a/src/library/scala/Long.scala +++ b/src/library/scala/Long.scala @@ -30,7 +30,7 @@ final class Long extends AnyVal { * @return the bitwise negation of this value * @example {{{ * ~5 == -6 - * // in binary: ~00000101 == + * // in binary: ~00000101 == * // 11111010 * }}} */ @@ -60,22 +60,22 @@ final class Long extends AnyVal { def <<(x: Long): Long = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ def >>>(x: Int): Long = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ @@ -85,8 +85,8 @@ final class Long extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -96,8 +96,8 @@ final class Long extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -281,9 +281,9 @@ final class Long extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -292,9 +292,9 @@ final class Long extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -303,9 +303,9 @@ final class Long extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -314,9 +314,9 @@ final class Long extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -325,9 +325,9 @@ final class Long extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -337,9 +337,9 @@ final class Long extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -348,9 +348,9 @@ final class Long extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -359,9 +359,9 @@ final class Long extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -370,9 +370,9 @@ final class Long extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -381,9 +381,9 @@ final class Long extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -393,9 +393,9 @@ final class Long extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -404,9 +404,9 @@ final class Long extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -415,9 +415,9 @@ final class Long extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -426,9 +426,9 @@ final class Long extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -437,9 +437,9 @@ final class Long extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -590,7 +590,7 @@ final class Long extends AnyVal { */ def %(x: Double): Double = sys.error("stub") - def getClass(): Class[Long] = sys.error("stub") + override def getClass(): Class[Long] = sys.error("stub") } object Long extends AnyValCompanion { diff --git a/src/library/scala/Short.scala b/src/library/scala/Short.scala index a9210d3555..98e227d992 100644 --- a/src/library/scala/Short.scala +++ b/src/library/scala/Short.scala @@ -30,7 +30,7 @@ final class Short extends AnyVal { * @return the bitwise negation of this value * @example {{{ * ~5 == -6 - * // in binary: ~00000101 == + * // in binary: ~00000101 == * // 11111010 * }}} */ @@ -60,22 +60,22 @@ final class Short extends AnyVal { def <<(x: Long): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ def >>>(x: Int): Int = sys.error("stub") /** * @return this value bit-shifted right by the specified number of bits, - * filling the new left bits with zeroes. + * filling the new left bits with zeroes. * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}} * @example {{{ - * -21 >>> 3 == 536870909 - * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == + * -21 >>> 3 == 536870909 + * // in binary: 11111111 11111111 11111111 11101011 >>> 3 == * // 00011111 11111111 11111111 11111101 * }}} */ @@ -85,8 +85,8 @@ final class Short extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -96,8 +96,8 @@ final class Short extends AnyVal { * 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 {{{ - * -21 >> 3 == -3 - * // in binary: 11111111 11111111 11111111 11101011 >> 3 == + * -21 >> 3 == -3 + * // in binary: 11111111 11111111 11111111 11101011 >> 3 == * // 11111111 11111111 11111111 11111101 * }}} */ @@ -281,9 +281,9 @@ final class Short extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -292,9 +292,9 @@ final class Short extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -303,9 +303,9 @@ final class Short extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -314,9 +314,9 @@ final class Short extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -325,9 +325,9 @@ final class Short extends AnyVal { * @return the bitwise OR of this value and x * @example {{{ * (0xf0 | 0xaa) == 0xfa - * // in binary: 11110000 - * // | 10101010 - * // -------- + * // in binary: 11110000 + * // | 10101010 + * // -------- * // 11111010 * }}} */ @@ -337,9 +337,9 @@ final class Short extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -348,9 +348,9 @@ final class Short extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -359,9 +359,9 @@ final class Short extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -370,9 +370,9 @@ final class Short extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -381,9 +381,9 @@ final class Short extends AnyVal { * @return the bitwise AND of this value and x * @example {{{ * (0xf0 & 0xaa) == 0xa0 - * // in binary: 11110000 - * // & 10101010 - * // -------- + * // in binary: 11110000 + * // & 10101010 + * // -------- * // 10100000 * }}} */ @@ -393,9 +393,9 @@ final class Short extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -404,9 +404,9 @@ final class Short extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -415,9 +415,9 @@ final class Short extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -426,9 +426,9 @@ final class Short extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -437,9 +437,9 @@ final class Short extends AnyVal { * @return the bitwise XOR of this value and x * @example {{{ * (0xf0 ^ 0xaa) == 0x5a - * // in binary: 11110000 - * // ^ 10101010 - * // -------- + * // in binary: 11110000 + * // ^ 10101010 + * // -------- * // 01011010 * }}} */ @@ -590,7 +590,7 @@ final class Short extends AnyVal { */ def %(x: Double): Double = sys.error("stub") - def getClass(): Class[Short] = sys.error("stub") + override def getClass(): Class[Short] = sys.error("stub") } object Short extends AnyValCompanion { diff --git a/src/library/scala/Unit.scala b/src/library/scala/Unit.scala index 57970b021b..f6ed0121ab 100644 --- a/src/library/scala/Unit.scala +++ b/src/library/scala/Unit.scala @@ -17,7 +17,7 @@ package scala * method which is declared `void`. */ final class Unit extends AnyVal { - def getClass(): Class[Unit] = sys.error("stub") + override def getClass(): Class[Unit] = sys.error("stub") } object Unit extends AnyValCompanion { diff --git a/test/files/pos/anyval-children.scala b/test/files/pos/anyval-children.scala new file mode 100644 index 0000000000..7a2eda8b3f --- /dev/null +++ b/test/files/pos/anyval-children.scala @@ -0,0 +1 @@ +class Bippy extends AnyVal \ No newline at end of file -- cgit v1.2.3