diff options
55 files changed, 411 insertions, 155 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Typers.scala b/src/compiler/scala/reflect/macros/runtime/Typers.scala index 79833d155e..398770ab35 100644 --- a/src/compiler/scala/reflect/macros/runtime/Typers.scala +++ b/src/compiler/scala/reflect/macros/runtime/Typers.scala @@ -11,7 +11,7 @@ trait Typers { def openImplicits: List[(Type, Tree)] = callsiteTyper.context.openImplicits /** - * @see [[scala.tools.reflect.Toolbox.typeCheck]] + * @see [[scala.tools.reflect.ToolBox.typeCheck]] */ def typeCheck(tree: Tree, pt: Type = universe.WildcardType, silent: Boolean = false, withImplicitViewsDisabled: Boolean = false, withMacrosDisabled: Boolean = false): Tree = { macroLogVerbose("typechecking %s with expected type %s, implicit views = %s, macros = %s".format(tree, pt, !withImplicitViewsDisabled, !withMacrosDisabled)) diff --git a/src/compiler/scala/reflect/reify/Reifier.scala b/src/compiler/scala/reflect/reify/Reifier.scala index 11857e2172..74949fce6d 100644 --- a/src/compiler/scala/reflect/reify/Reifier.scala +++ b/src/compiler/scala/reflect/reify/Reifier.scala @@ -8,8 +8,9 @@ import scala.reflect.reify.utils.Utils /** Given a tree or a type, generate a tree that when executed at runtime produces the original tree or type. * See more info in the comments to `reify` in scala.reflect.api.Universe. * - * @author Martin Odersky - * @version 2.10 + * @author Martin Odersky + * @version 2.10 + * @since 2.10 */ abstract class Reifier extends States with Phases @@ -31,20 +32,20 @@ abstract class Reifier extends States this.asInstanceOf[Reifier { val global: Reifier.this.global.type }] override def hasReifier = true - /** - * For `reifee` and other reification parameters, generate a tree of the form - * + /** For `reifee` and other reification parameters, generate a tree of the form + * {{{ * { - * val $u: universe.type = <[ universe ]> - * val $m: $u.Mirror = <[ mirror ]> - * $u.Expr[T](rtree) // if data is a Tree - * $u.TypeTag[T](rtree) // if data is a Type + * val \$u: universe.type = <[ universe ]> + * val \$m: \$u.Mirror = <[ mirror ]> + * \$u.Expr[T](rtree) // if data is a Tree + * \$u.TypeTag[T](rtree) // if data is a Type * } + * }}} * * where * - * - `universe` is the tree that represents the universe the result will be bound to - * - `mirror` is the tree that represents the mirror the result will be initially bound to + * - `universe` is the tree that represents the universe the result will be bound to. + * - `mirror` is the tree that represents the mirror the result will be initially bound to. * - `rtree` is code that generates `reifee` at runtime. * - `T` is the type that corresponds to `data`. * diff --git a/src/compiler/scala/reflect/reify/phases/Metalevels.scala b/src/compiler/scala/reflect/reify/phases/Metalevels.scala index 18ea908cdf..ea6b5886cc 100644 --- a/src/compiler/scala/reflect/reify/phases/Metalevels.scala +++ b/src/compiler/scala/reflect/reify/phases/Metalevels.scala @@ -11,7 +11,7 @@ trait Metalevels { /** * Makes sense of cross-stage bindings. * - * ================ + * ---------------- * * Analysis of cross-stage bindings becomes convenient if we introduce the notion of metalevels. * Metalevel of a tree is a number that gets incremented every time you reify something and gets decremented when you splice something. @@ -53,7 +53,7 @@ trait Metalevels { * 1) Runtime eval that services dynamic splices requires scala-compiler.jar, which might not be on library classpath * 2) Runtime eval incurs a severe performance penalty, so it'd better to be explicit about it * - * ================ + * ---------------- * * As we can see, the only problem is the fact that lhs'es of `splice` can be code blocks that can capture variables from the outside. * Code inside the lhs of an `splice` is not reified, while the code from the enclosing reify is. diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala index 35d4eaf1b6..7e01afac2b 100644 --- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala +++ b/src/compiler/scala/tools/cmd/gen/AnyVals.scala @@ -22,8 +22,8 @@ trait AnyValReps { } def coercionCommentExtra = "" def coercionComment = """ - /** Language mandated coercions from @name@ to "wider" types.%s - */""".format(coercionCommentExtra) +/** Language mandated coercions from @name@ to "wider" types.%s + */""".format(coercionCommentExtra) def implicitCoercions: List[String] = { val coercions = this match { @@ -35,7 +35,7 @@ trait AnyValReps { case _ => Nil } if (coercions.isEmpty) Nil - else coercionComment :: coercions + else coercionComment.lines.toList ++ coercions } def isCardinal: Boolean = isIntegerType(this) @@ -183,7 +183,7 @@ trait AnyValReps { } def objectLines = { val comp = if (isCardinal) cardinalCompanion else floatingCompanion - (comp + allCompanions + "\n" + nonUnitCompanions).trim.lines.toList ++ implicitCoercions map interpolate + interpolate(comp + allCompanions + "\n" + nonUnitCompanions).trim.lines.toList ++ (implicitCoercions map interpolate) } /** Makes a set of binary operations based on the given set of ops, args, and resultFn. @@ -209,11 +209,14 @@ trait AnyValReps { ) def lcname = name.toLowerCase + def boxedSimpleName = this match { + case C => "Character" + case I => "Integer" + case _ => name + } def boxedName = this match { case U => "scala.runtime.BoxedUnit" - case C => "java.lang.Character" - case I => "java.lang.Integer" - case _ => "java.lang." + name + case _ => "java.lang." + boxedSimpleName } def zeroRep = this match { case L => "0L" @@ -228,7 +231,13 @@ trait AnyValReps { def indentN(s: String) = s.lines map indent mkString "\n" def boxUnboxImpls = Map( + "@boxRunTimeDoc@" -> """ + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxTo%s`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + *""".format(boxedSimpleName), "@boxImpl@" -> "%s.valueOf(x)".format(boxedName), + "@unboxRunTimeDoc@" -> """ + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxTo%s`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + *""".format(name), "@unboxImpl@" -> "x.asInstanceOf[%s].%sValue()".format(boxedName, lcname), "@unboxDoc@" -> "the %s resulting from calling %sValue() on `x`".format(name, lcname) ) @@ -299,7 +308,7 @@ import scala.language.implicitConversions def allCompanions = """ /** Transform a value type into a boxed reference type. - * + *@boxRunTimeDoc@ * @param x the @name@ to be boxed * @return a @boxed@ offering `x` as its underlying value. */ @@ -308,7 +317,7 @@ def box(x: @name@): @boxed@ = @boxImpl@ /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a @boxed@. - * + *@unboxRunTimeDoc@ * @param x the @boxed@ to be unboxed. * @throws ClassCastException if the argument is not a @boxed@ * @return @unboxDoc@ @@ -471,7 +480,9 @@ override def getClass(): Class[Boolean] = null def objectLines = interpolate(allCompanions).lines.toList override def boxUnboxImpls = Map( + "@boxRunTimeDoc@" -> "", "@boxImpl@" -> "scala.runtime.BoxedUnit.UNIT", + "@unboxRunTimeDoc@" -> "", "@unboxImpl@" -> "()", "@unboxDoc@" -> "the Unit value ()" ) diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index 5ad494177c..f2e5c9b1eb 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -366,7 +366,10 @@ trait DocComments { self: Global => case vname => lookupVariable(vname, site) match { case Some(replacement) => replaceWith(replacement) - case None => reporter.warning(sym.pos, "Variable " + vname + " undefined in comment for " + sym + " in " + site) + case None => + val pos = docCommentPos(sym) + val loc = pos withPoint (pos.start + vstart + 1) + reporter.warning(loc, s"Variable $vname undefined in comment for $sym in $site") } } } diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 7671912651..bd3af5f9a2 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -361,7 +361,7 @@ self => if (mainModuleName == newTermName(ScriptRunner.defaultScriptMain)) searchForMain() foreach { return _ } - /** Here we are building an AST representing the following source fiction, + /* Here we are building an AST representing the following source fiction, * where `moduleName` is from -Xscript (defaults to "Main") and <stmts> are * the result of parsing the script file. * @@ -2222,16 +2222,18 @@ self => * }}} */ def typeBounds(): TypeBoundsTree = { - val t = TypeBoundsTree( - bound(SUPERTYPE, tpnme.Nothing), - bound(SUBTYPE, tpnme.Any) - ) - t setPos wrappingPos(List(t.hi, t.lo)) + val lo = bound(SUPERTYPE) + val hi = bound(SUBTYPE) + val t = TypeBoundsTree(lo, hi) + val defined = List(t.hi, t.lo) filter (_.pos.isDefined) + + if (defined.nonEmpty) + t setPos wrappingPos(defined) + else + t setPos o2p(in.offset) } - def bound(tok: Int, default: TypeName): Tree = - if (in.token == tok) { in.nextToken(); typ() } - else atPos(o2p(in.lastOffset)) { rootScalaDot(default) } + def bound(tok: Int): Tree = if (in.token == tok) { in.nextToken(); typ() } else EmptyTree /* -------- DEFS ------------------------------------------- */ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 66a58870cc..1b183ddd3f 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -25,6 +25,10 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { import icodes.opcodes._ import definitions._ + // Strangely I can't find this in the asm code + // 255, but reserving 1 for "this" + final val MaximumJvmParameters = 254 + val phaseName = "jvm" /** Create a new phase */ @@ -1480,6 +1484,11 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { if (m.symbol.isStaticConstructor || definitions.isGetClass(m.symbol)) return + if (m.params.size > MaximumJvmParameters) { + getCurrentCUnit().error(m.symbol.pos, s"Platform restriction: a parameter list's length cannot exceed $MaximumJvmParameters.") + return + } + debuglog("Generating method " + m.symbol.fullName) method = m computeLocalVarsIndex(m) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala index 2ad474cf3f..59df8e56c1 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala @@ -8,11 +8,11 @@ package backend.jvm import scala.tools.nsc.io.AbstractFile import scala.tools.nsc.symtab._ -/** Code shared between the legagy backend [[scala.tools.nsc.backend.jvm.GenJVM]] - * and the new backend [[scala.tools.nsc.backend.jvm.GenASM]]. There should be - * more here, but for now I'm starting with the refactorings that are either - * straightforward to review or necessary for maintenance. - */ +/** Code shared between the erstwhile legacy backend (aka GenJVM) + * and the new backend [[scala.tools.nsc.backend.jvm.GenASM]]. There should be + * more here, but for now I'm starting with the refactorings that are either + * straightforward to review or necessary for maintenance. + */ trait GenJVMASM { val global: Global import global._ diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index f1b1d1a9a7..786754ce4c 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -293,15 +293,8 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { if (in.token == QMARK) { val pos = in.currentPos in.nextToken() - var lo: Tree = TypeTree(NothingClass.tpe) - var hi: Tree = TypeTree(AnyClass.tpe) - if (in.token == EXTENDS) { - in.nextToken() - hi = typ() - } else if (in.token == SUPER) { - in.nextToken() - lo = typ() - } + val hi = if (in.token == EXTENDS) { in.nextToken() ; typ() } else EmptyTree + val lo = if (in.token == SUPER) { in.nextToken() ; typ() } else EmptyTree val tdef = atPos(pos) { TypeDef( Modifiers(Flags.JAVA | Flags.DEFERRED), @@ -408,15 +401,8 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def typeParam(): TypeDef = atPos(in.currentPos) { val name = identForType() - val hi = - if (in.token == EXTENDS) { - in.nextToken() - bound() - } else { - scalaDot(tpnme.Any) - } - TypeDef(Modifiers(Flags.JAVA | Flags.DEFERRED | Flags.PARAM), name, List(), - TypeBoundsTree(scalaDot(tpnme.Nothing), hi)) + val hi = if (in.token == EXTENDS) { in.nextToken() ; bound() } else EmptyTree + TypeDef(Modifiers(Flags.JAVA | Flags.DEFERRED | Flags.PARAM), name, Nil, TypeBoundsTree(EmptyTree, hi)) } def bound(): Tree = diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index a8a47205dd..7cec57968c 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -1179,7 +1179,7 @@ abstract class ClassfileParser { else enclosing.info member name ) enteringTyperIfPossible(getMember) - /** There used to be an assertion that this result is not NoSymbol; changing it to an error + /* There used to be an assertion that this result is not NoSymbol; changing it to an error * revealed it had been going off all the time, but has been swallowed by a catch t: Throwable * in Repository.scala. Since it has been accomplishing nothing except misleading anyone who * thought it wasn't triggering, I removed it entirely. diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index 50487ad123..7aaeb56deb 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -73,7 +73,7 @@ abstract class ICodeReader extends ClassfileParser { private def parseMember(field: Boolean): (JavaAccFlags, Symbol) = { val jflags = JavaAccFlags(u2) val name = pool getName u2 - /** If we're parsing a scala module, the owner of members is always + /* If we're parsing a scala module, the owner of members is always * the module symbol. */ val owner = ( diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index ac18e5ba4f..2ece06c801 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -266,7 +266,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { gen.mkMethodCall(definitions.Boxes_isNumber, t :: Nil) ) - /** The Tree => Tree function in the return is necessary to prevent the original qual + /* The Tree => Tree function in the return is necessary to prevent the original qual * from being duplicated in the resulting code. It may be a side-effecting expression, * so all the test logic is routed through gen.evalOnce, which creates a block like * { val x$1 = qual; if (x$1.foo || x$1.bar) f1(x$1) else f2(x$1) } diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 367825c251..1aa5f10738 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -378,7 +378,7 @@ abstract class ExplicitOuter extends InfoTransform if (outerAcc.isDeferred) EmptyTree else This(currentClass) DOT outerField(currentClass) - /** If we don't re-type the tree, we see self-type related crashes like #266. + /* If we don't re-type the tree, we see self-type related crashes like #266. */ localTyper typed { (DEF(outerAcc) withPos currentClass.pos withType null) === rhs diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 35df63b246..8774390c8c 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -807,7 +807,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { override def apply[T <: Tree](tree: T): T = if (from.isEmpty) tree else super.apply(tree) } - /** return a 'lazified' version of rhs. It uses double-checked locking to ensure + /* return a 'lazified' version of rhs. It uses double-checked locking to ensure * initialization is performed at most once. For performance reasons the double-checked * locking is split into two parts, the first (fast) path checks the bitmap without * synchronizing, and if that fails it initializes the lazy val within the @@ -1145,7 +1145,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { qual case Apply(Select(qual, _), args) => - /** Changes `qual.m(args)` where m refers to an implementation + /* Changes `qual.m(args)` where m refers to an implementation * class method to Q.m(S, args) where Q is the implementation module of * `m` and S is the self parameter for the call, which * is determined as follows: diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 6f3771b58d..4b00c0efe9 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1389,7 +1389,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { def transform1(tree: Tree) = { val symbol = tree.symbol - /** The specialized symbol of 'tree.symbol' for tree.tpe, if there is one */ + /* The specialized symbol of 'tree.symbol' for tree.tpe, if there is one */ def specSym(qual: Tree): Symbol = { val env = unify(symbol.tpe, tree.tpe, emptyEnv, false) def isMatch(member: Symbol) = ( diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 7a4b28486b..f63e762187 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -611,7 +611,7 @@ trait Contexts { self: Analyzer => (linked ne NoSymbol) && accessWithin(linked) } - /** Are we inside definition of `ab`? */ + /* Are we inside definition of `ab`? */ def accessWithin(ab: Symbol) = { // #3663: we must disregard package nesting if sym isJavaDefined if (sym.isJavaDefined) { diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 37a7e3c8cc..6f724f5b41 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -5133,8 +5133,8 @@ trait Typers extends Adaptations with Tags { } def typedTypeBoundsTree(tree: TypeBoundsTree) = { - val lo1 = typedType(tree.lo, mode) - val hi1 = typedType(tree.hi, mode) + val lo1 = if (tree.lo.isEmpty) TypeTree(NothingTpe) else typedType(tree.lo, mode) + val hi1 = if (tree.hi.isEmpty) TypeTree(AnyTpe) else typedType(tree.hi, mode) treeCopy.TypeBoundsTree(tree, lo1, hi1) setType TypeBounds(lo1.tpe, hi1.tpe) } diff --git a/src/library/scala/Boolean.scala b/src/library/scala/Boolean.scala index e43b7d0a82..ddd11257c6 100644 --- a/src/library/scala/Boolean.scala +++ b/src/library/scala/Boolean.scala @@ -10,6 +10,8 @@ package scala +import scala.language.implicitConversions + /** `Boolean` (equivalent to Java's `boolean` primitive type) is a * subtype of [[scala.AnyVal]]. Instances of `Boolean` are not * represented by an object in the underlying runtime system. @@ -114,6 +116,8 @@ object Boolean extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToBoolean`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Boolean to be boxed * @return a java.lang.Boolean offering `x` as its underlying value. */ @@ -123,6 +127,8 @@ object Boolean extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Boolean. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToBoolean`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Boolean to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Boolean * @return the Boolean resulting from calling booleanValue() on `x` diff --git a/src/library/scala/Byte.scala b/src/library/scala/Byte.scala index d1979236d3..2510e859c0 100644 --- a/src/library/scala/Byte.scala +++ b/src/library/scala/Byte.scala @@ -606,6 +606,8 @@ object Byte extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToByte`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Byte to be boxed * @return a java.lang.Byte offering `x` as its underlying value. */ @@ -615,6 +617,8 @@ object Byte extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Byte. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToByte`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Byte to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Byte * @return the Byte resulting from calling byteValue() on `x` diff --git a/src/library/scala/Char.scala b/src/library/scala/Char.scala index 00ddff5b3b..1c9a2ba44f 100644 --- a/src/library/scala/Char.scala +++ b/src/library/scala/Char.scala @@ -606,6 +606,8 @@ object Char extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToCharacter`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Char to be boxed * @return a java.lang.Character offering `x` as its underlying value. */ @@ -615,6 +617,8 @@ object Char extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Character. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToChar`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Character to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Character * @return the Char resulting from calling charValue() on `x` diff --git a/src/library/scala/Double.scala b/src/library/scala/Double.scala index 85bf9fe5c5..ce081bbec1 100644 --- a/src/library/scala/Double.scala +++ b/src/library/scala/Double.scala @@ -10,6 +10,8 @@ package scala +import scala.language.implicitConversions + /** `Double`, a 64-bit IEEE-754 floating point number (equivalent to Java's `double` primitive type) is a * subtype of [[scala.AnyVal]]. Instances of `Double` are not * represented by an object in the underlying runtime system. @@ -380,6 +382,8 @@ object Double extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToDouble`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Double to be boxed * @return a java.lang.Double offering `x` as its underlying value. */ @@ -389,6 +393,8 @@ object Double extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Double. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToDouble`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Double to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Double * @return the Double resulting from calling doubleValue() on `x` diff --git a/src/library/scala/Float.scala b/src/library/scala/Float.scala index f67f45897f..4ff2d509b8 100644 --- a/src/library/scala/Float.scala +++ b/src/library/scala/Float.scala @@ -382,6 +382,8 @@ object Float extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToFloat`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Float to be boxed * @return a java.lang.Float offering `x` as its underlying value. */ @@ -391,6 +393,8 @@ object Float extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Float. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToFloat`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Float to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Float * @return the Float resulting from calling floatValue() on `x` diff --git a/src/library/scala/Int.scala b/src/library/scala/Int.scala index 1bacdbcee9..6a27195b10 100644 --- a/src/library/scala/Int.scala +++ b/src/library/scala/Int.scala @@ -606,6 +606,8 @@ object Int extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToInteger`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Int to be boxed * @return a java.lang.Integer offering `x` as its underlying value. */ @@ -615,6 +617,8 @@ object Int extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Integer. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToInt`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Integer to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Integer * @return the Int resulting from calling intValue() on `x` diff --git a/src/library/scala/Long.scala b/src/library/scala/Long.scala index 83adcda819..4d369ae010 100644 --- a/src/library/scala/Long.scala +++ b/src/library/scala/Long.scala @@ -606,6 +606,8 @@ object Long extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToLong`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Long to be boxed * @return a java.lang.Long offering `x` as its underlying value. */ @@ -615,6 +617,8 @@ object Long extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Long. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToLong`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Long to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Long * @return the Long resulting from calling longValue() on `x` diff --git a/src/library/scala/Short.scala b/src/library/scala/Short.scala index cdd298e542..4f91c51550 100644 --- a/src/library/scala/Short.scala +++ b/src/library/scala/Short.scala @@ -606,6 +606,8 @@ object Short extends AnyValCompanion { /** Transform a value type into a boxed reference type. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxToShort`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the Short to be boxed * @return a java.lang.Short offering `x` as its underlying value. */ @@ -615,6 +617,8 @@ object Short extends AnyValCompanion { * method is not typesafe: it accepts any Object, but will throw * an exception if the argument is not a java.lang.Short. * + * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxToShort`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. + * * @param x the java.lang.Short to be unboxed. * @throws ClassCastException if the argument is not a java.lang.Short * @return the Short resulting from calling shortValue() on `x` diff --git a/src/library/scala/Unit.scala b/src/library/scala/Unit.scala index 01e592ec3c..0e59a184d1 100644 --- a/src/library/scala/Unit.scala +++ b/src/library/scala/Unit.scala @@ -10,6 +10,9 @@ package scala +import scala.language.implicitConversions + + /** `Unit` is a subtype of [[scala.AnyVal]]. There is only one value of type * `Unit`, `()`, and it is not represented by any object in the underlying * runtime system. A method with return type `Unit` is analogous to a Java diff --git a/src/library/scala/collection/BitSetLike.scala b/src/library/scala/collection/BitSetLike.scala index 034ed2b24a..9c4e710558 100644 --- a/src/library/scala/collection/BitSetLike.scala +++ b/src/library/scala/collection/BitSetLike.scala @@ -106,8 +106,8 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe private var current = start private val end = nwords * WordLength def hasNext: Boolean = { - while (current < end && !self.contains(current)) current += 1 - current < end + while (current != end && !self.contains(current)) current += 1 + current != end } def next(): Int = if (hasNext) { val r = current; current += 1; r } @@ -117,7 +117,10 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe override def foreach[B](f: Int => B) { for (i <- 0 until nwords) { val w = word(i) - for (j <- i * WordLength until (i + 1) * WordLength) { + /* NOTE: `until` instead of `to` will not work here because + the maximum value of `(i + 1) * WordLength` could be + `Int.MaxValue + 1` (i.e. `Int.MinValue`). */ + for (j <- i * WordLength to (i + 1) * WordLength - 1) { if ((w & (1L << j)) != 0L) f(j) } } @@ -197,11 +200,15 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe override def addString(sb: StringBuilder, start: String, sep: String, end: String) = { sb append start var pre = "" - for (i <- 0 until nwords * WordLength) + val max = nwords * WordLength + var i = 0 + while(i != max) { if (contains(i)) { sb append pre append i pre = sep } + i += 1 + } sb append end } @@ -212,6 +219,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe object BitSetLike { private[collection] val LogWL = 6 private val WordLength = 64 + private[collection] val MaxSize = (Int.MaxValue >> LogWL) + 1 private[collection] def updateArray(elems: Array[Long], idx: Int, w: Long): Array[Long] = { var len = elems.length diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index be233d06cb..f3559f7d26 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -85,7 +85,8 @@ sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A, List] - with LinearSeqOptimized[A, List[A]] { + with LinearSeqOptimized[A, List[A]] + with Serializable { override def companion: GenericCompanion[List] = List import scala.collection.{Iterable, Traversable, Seq, IndexedSeq} diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala index 397f8099eb..29c341590d 100644 --- a/src/library/scala/collection/mutable/BitSet.scala +++ b/src/library/scala/collection/mutable/BitSet.scala @@ -12,7 +12,7 @@ package scala.collection package mutable import generic._ -import BitSetLike.{LogWL, updateArray} +import BitSetLike.{LogWL, MaxSize, updateArray} /** A class for mutable bitsets. * @@ -63,9 +63,10 @@ class BitSet(protected var elems: Array[Long]) extends AbstractSet[Int] } private def ensureCapacity(idx: Int) { + require(idx < MaxSize) if (idx >= nwords) { var newlen = nwords - while (idx >= newlen) newlen = newlen * 2 + while (idx >= newlen) newlen = (newlen * 2) min MaxSize val elems1 = new Array[Long](newlen) Array.copy(elems, 0, elems1, 0, nwords) elems = elems1 diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala index f72e1fc4e7..f68e4004f2 100644 --- a/src/library/scala/collection/mutable/Map.scala +++ b/src/library/scala/collection/mutable/Map.scala @@ -47,7 +47,7 @@ trait Map[A, B] */ def withDefaultValue(d: B): mutable.Map[A, B] = new Map.WithDefault[A, B](this, x => d) - /** Return a read-only projection of this map. !!! or just use an (immutable) MapProxy? + /* Return a read-only projection of this map. !!! or just use an (immutable) MapProxy? def readOnly : scala.collection.Map[A, B] = new scala.collection.Map[A, B] { override def size = self.size override def update(key: A, value: B) = self.update(key, value) diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala index d8f4337b8f..c5e5699468 100644 --- a/src/library/scala/math/BigDecimal.scala +++ b/src/library/scala/math/BigDecimal.scala @@ -333,21 +333,21 @@ extends ScalaNumber with ScalaNumericConversions with Serializable { override def byteValue = intValue.toByte /** Converts this BigDecimal to a Short. - * If the BigDecimal is too big to fit in a Byte, only the low-order 16 bits are returned. + * If the BigDecimal is too big to fit in a Short, only the low-order 16 bits are returned. * Note that this conversion can lose information about the overall magnitude of the * BigDecimal value as well as return a result with the opposite sign. */ override def shortValue = intValue.toShort /** Converts this BigDecimal to a Char. - * If the BigDecimal is too big to fit in a char, only the low-order 16 bits are returned. + * If the BigDecimal is too big to fit in a Char, only the low-order 16 bits are returned. * Note that this conversion can lose information about the overall magnitude of the * BigDecimal value and that it always returns a positive result. */ def charValue = intValue.toChar /** Converts this BigDecimal to an Int. - * If the BigDecimal is too big to fit in a char, only the low-order 32 bits + * If the BigDecimal is too big to fit in an Int, only the low-order 32 bits * are returned. Note that this conversion can lose information about the * overall magnitude of the BigDecimal value as well as return a result with * the opposite sign. @@ -355,7 +355,7 @@ extends ScalaNumber with ScalaNumericConversions with Serializable { def intValue = this.bigDecimal.intValue /** Converts this BigDecimal to a Long. - * If the BigDecimal is too big to fit in a char, only the low-order 64 bits + * If the BigDecimal is too big to fit in a Long, only the low-order 64 bits * are returned. Note that this conversion can lose information about the * overall magnitude of the BigDecimal value as well as return a result with * the opposite sign. diff --git a/src/partest/scala/tools/partest/nest/PathSettings.scala b/src/partest/scala/tools/partest/nest/PathSettings.scala index b1f868c9d2..bae6bf819d 100644 --- a/src/partest/scala/tools/partest/nest/PathSettings.scala +++ b/src/partest/scala/tools/partest/nest/PathSettings.scala @@ -27,8 +27,8 @@ object PathSettings { candidates find isPartestDir getOrElse sys.error("Directory 'test' not found.") } - // Directory <root>/test/files - lazy val srcDir = Directory(testRoot / srcDirName toCanonical) + // Directory <root>/test/files or .../scaladoc + def srcDir = Directory(testRoot / srcDirName toCanonical) // Directory <root>/test/files/lib lazy val srcLibDir = Directory(srcDir / "lib") @@ -82,7 +82,7 @@ object PathSettings { * if one of those environment variables is set, then the lib directory under java.home, * and finally the lib directory under the parent of java.home. Or, as a last resort, * search deeply under those locations (except for the parent of java.home, on the notion - * that if this is not a canonical installation, then that search would have litte + * that if this is not a canonical installation, then that search would have little * chance of succeeding). */ lazy val platformTools: Option[File] = { diff --git a/src/reflect/scala/reflect/internal/ClassfileConstants.scala b/src/reflect/scala/reflect/internal/ClassfileConstants.scala index faf61e5205..b682b7d0ca 100644 --- a/src/reflect/scala/reflect/internal/ClassfileConstants.scala +++ b/src/reflect/scala/reflect/internal/ClassfileConstants.scala @@ -9,7 +9,6 @@ package internal import scala.annotation.switch object ClassfileConstants { - final val JAVA_MAGIC = 0xCAFEBABE final val JAVA_MAJOR_VERSION = 45 final val JAVA_MINOR_VERSION = 3 diff --git a/src/reflect/scala/reflect/internal/Printers.scala b/src/reflect/scala/reflect/internal/Printers.scala index 5b80889225..b8e73e51f3 100644 --- a/src/reflect/scala/reflect/internal/Printers.scala +++ b/src/reflect/scala/reflect/internal/Printers.scala @@ -421,7 +421,14 @@ trait Printers extends api.Printers { self: SymbolTable => print(tp); printRow(args, "[", ", ", "]") case TypeBoundsTree(lo, hi) => - printOpt(" >: ", lo); printOpt(" <: ", hi) + // Avoid printing noisy empty typebounds everywhere + // Untyped empty bounds are not printed by printOpt, + // but after they are typed we have to exclude Nothing/Any. + if ((lo.tpe eq null) || !(lo.tpe =:= definitions.NothingTpe)) + printOpt(" >: ", lo) + + if ((hi.tpe eq null) || !(hi.tpe =:= definitions.AnyTpe)) + printOpt(" <: ", hi) case ExistentialTypeTree(tpt, whereClauses) => print(tpt) diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 60d9e1c3cd..cd41f533bb 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -3062,7 +3062,7 @@ trait Types else lhs <:< rhs } - /** Simple case: type arguments can be ignored, because either this typevar has + /* Simple case: type arguments can be ignored, because either this typevar has * no type parameters, or we are comparing to Any/Nothing. * * The latter condition is needed because HK unification is limited to constraints of the shape @@ -3089,7 +3089,7 @@ trait Types } else false } - /** Full case: involving a check of the form + /* Full case: involving a check of the form * {{{ * TC1[T1,..., TN] <: TC2[T'1,...,T'N] * }}} diff --git a/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala b/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala index da8e64ea16..c1fb0c0107 100644 --- a/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala +++ b/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala @@ -186,7 +186,7 @@ trait TypeComparers { } def isSameType2(tp1: Type, tp2: Type): Boolean = { - /** Here we highlight those unfortunate type-like constructs which + /* Here we highlight those unfortunate type-like constructs which * are hidden bundles of mutable state, cruising the type system picking * up any type constraints naive enough to get into their hot rods. */ @@ -215,7 +215,7 @@ trait TypeComparers { } case _ => false } - /** Those false cases certainly are ugly. There's a proposed SIP to deuglify it. + /* Those false cases certainly are ugly. There's a proposed SIP to deuglify it. * https://docs.google.com/a/improving.org/document/d/1onPrzSqyDpHScc9PS_hpxJwa3FlPtthxw-bAuuEe8uA */ def sameTypeAndSameCaseClass = tp1 match { diff --git a/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala b/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala index bf6d6ffed7..003c439f65 100644 --- a/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala +++ b/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala @@ -9,7 +9,6 @@ package doc import scala.tools.nsc.ast.parser.{ SyntaxAnalyzer, BracePatch } import scala.reflect.internal.Chars._ import symtab._ -import reporters.Reporter import typechecker.Analyzer import scala.reflect.internal.util.{ BatchSourceFile, RangePosition } @@ -150,20 +149,54 @@ abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends Syntax class ScaladocUnitScanner(unit0: CompilationUnit, patches0: List[BracePatch]) extends UnitScanner(unit0, patches0) { - private var docBuffer: StringBuilder = null // buffer for comments - private var docPos: Position = NoPosition // last doc comment position - private var inDocComment = false + private var docBuffer: StringBuilder = null // buffer for comments (non-null while scanning) + private var inDocComment = false // if buffer contains double-star doc comment + private var lastDoc: DocComment = null // last comment if it was double-star doc + private lazy val unmooredParser = { // minimalist comment parser + import scala.tools.nsc.doc.base.{comment => _, _} + new { + val global: Global = ScaladocSyntaxAnalyzer.this.global + } with CommentFactoryBase with MemberLookupBase { + import global.{ settings, Symbol } + def parseComment(comment: DocComment) = { + val nowarnings = settings.nowarn.value + settings.nowarn.value = true + try parseAtSymbol(comment.raw, comment.raw, comment.pos) + finally settings.nowarn.value = nowarnings + } + + override def internalLink(sym: Symbol, site: Symbol): Option[LinkTo] = None + override def chooseLink(links: List[LinkTo]): LinkTo = links.headOption orNull + override def toString(link: LinkTo): String = "No link" + override def findExternalLink(sym: Symbol, name: String): Option[LinkToExternal] = None + override def warnNoLink: Boolean = false + } + } + + /** + * Warn when discarding buffered doc at the end of a block. + * This mechanism doesn't warn about arbitrary unmoored doc. + * Also warn under -Xlint, but otherwise only warn in the presence of suspicious + * tags that appear to be documenting API. Warnings are suppressed while parsing + * the local comment so that comments of the form `[at] Martin` will not trigger a warning. + * By omission, tags for `see`, `todo`, `note` and `example` are ignored. + */ override def discardDocBuffer() = { + import scala.tools.nsc.doc.base.comment.Comment val doc = flushDoc - if (doc ne null) - unit.warning(docPos, "discarding unmoored doc comment") + // tags that make a local double-star comment look unclean, as though it were API + def unclean(comment: Comment): Boolean = { + import comment._ + authors.nonEmpty || result.nonEmpty || throws.nonEmpty || valueParams.nonEmpty || + typeParams.nonEmpty || version.nonEmpty || since.nonEmpty + } + def isDirty = unclean(unmooredParser parseComment doc) + if ((doc ne null) && (settings.lint || isDirty)) + unit.warning(doc.pos, "discarding unmoored doc comment") } - override def flushDoc(): DocComment = { - if (docBuffer eq null) null - else try DocComment(docBuffer.toString, docPos) finally docBuffer = null - } + override def flushDoc(): DocComment = (try lastDoc finally lastDoc = null) override protected def putCommentChar() { if (inDocComment) @@ -182,23 +215,19 @@ abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends Syntax super.skipBlockComment() } override def skipComment(): Boolean = { - super.skipComment() && { - if (docBuffer ne null) { - if (inDocComment) - foundDocComment(docBuffer.toString, offset, charOffset - 2) - else - try foundComment(docBuffer.toString, offset, charOffset - 2) finally docBuffer = null - } + // emit a block comment; if it's double-star, make Doc at this pos + def foundStarComment(start: Int, end: Int) = try { + val str = docBuffer.toString + val pos = new RangePosition(unit.source, start, start, end) + unit.comment(pos, str) + if (inDocComment) + lastDoc = DocComment(str, pos) true + } finally { + docBuffer = null + inDocComment = false } - } - def foundComment(value: String, start: Int, end: Int) { - val pos = new RangePosition(unit.source, start, start, end) - unit.comment(pos, value) - } - def foundDocComment(value: String, start: Int, end: Int) { - docPos = new RangePosition(unit.source, start, start, end) - unit.comment(docPos, value) + super.skipComment() && ((docBuffer eq null) || foundStarComment(offset, charOffset - 2)) } } class ScaladocUnitParser(unit: CompilationUnit, patches: List[BracePatch]) extends UnitParser(unit, patches) { diff --git a/test/files/neg/t7324.check b/test/files/neg/t7324.check new file mode 100644 index 0000000000..586947d5e7 --- /dev/null +++ b/test/files/neg/t7324.check @@ -0,0 +1,4 @@ +t7324.scala:2: error: Platform restriction: a parameter list's length cannot exceed 254. +class Bar( + ^ +one error found diff --git a/test/files/neg/t7324.scala b/test/files/neg/t7324.scala new file mode 100644 index 0000000000..81d7674d68 --- /dev/null +++ b/test/files/neg/t7324.scala @@ -0,0 +1,57 @@ +object Bar extends App +class Bar( +_1: Int, _2: Int, _3: Int, _4: Int, _5: Int, _6: Int, _7: Int, _8: Int, _9: Int, _10: Int, +_11: Int, _12: Int, _13: Int, _14: Int, _15: Int, _16: Int, _17: Int, _18: Int, _19: Int, _20: Int, +_21: Int, _22: Int, _23: Int, _24: Int, _25: Int, _26: Int, _27: Int, _28: Int, _29: Int, _30: Int, +_31: Int, _32: Int, _33: Int, _34: Int, _35: Int, _36: Int, _37: Int, _38: Int, _39: Int, _40: Int, +_41: Int, _42: Int, _43: Int, _44: Int, _45: Int, _46: Int, _47: Int, _48: Int, _49: Int, _50: Int, +_51: Int, _52: Int, _53: Int, _54: Int, _55: Int, _56: Int, _57: Int, _58: Int, _59: Int, _60: Int, +_61: Int, _62: Int, _63: Int, _64: Int, _65: Int, _66: Int, _67: Int, _68: Int, _69: Int, _70: Int, +_71: Int, _72: Int, _73: Int, _74: Int, _75: Int, _76: Int, _77: Int, _78: Int, _79: Int, _80: Int, +_81: Int, _82: Int, _83: Int, _84: Int, _85: Int, _86: Int, _87: Int, _88: Int, _89: Int, _90: Int, +_91: Int, _92: Int, _93: Int, _94: Int, _95: Int, _96: Int, _97: Int, _98: Int, _99: Int, _100: Int, +_101: Int, _102: Int, _103: Int, _104: Int, _105: Int, _106: Int, _107: Int, _108: Int, _109: Int, _110: Int, +_111: Int, _112: Int, _113: Int, _114: Int, _115: Int, _116: Int, _117: Int, _118: Int, _119: Int, _120: Int, +_121: Int, _122: Int, _123: Int, _124: Int, _125: Int, _126: Int, _127: Int, _128: Int, _129: Int, _130: Int, +_131: Int, _132: Int, _133: Int, _134: Int, _135: Int, _136: Int, _137: Int, _138: Int, _139: Int, _140: Int, +_141: Int, _142: Int, _143: Int, _144: Int, _145: Int, _146: Int, _147: Int, _148: Int, _149: Int, _150: Int, +_151: Int, _152: Int, _153: Int, _154: Int, _155: Int, _156: Int, _157: Int, _158: Int, _159: Int, _160: Int, +_161: Int, _162: Int, _163: Int, _164: Int, _165: Int, _166: Int, _167: Int, _168: Int, _169: Int, _170: Int, +_171: Int, _172: Int, _173: Int, _174: Int, _175: Int, _176: Int, _177: Int, _178: Int, _179: Int, _180: Int, +_181: Int, _182: Int, _183: Int, _184: Int, _185: Int, _186: Int, _187: Int, _188: Int, _189: Int, _190: Int, +_191: Int, _192: Int, _193: Int, _194: Int, _195: Int, _196: Int, _197: Int, _198: Int, _199: Int, _200: Int, +_201: Int, _202: Int, _203: Int, _204: Int, _205: Int, _206: Int, _207: Int, _208: Int, _209: Int, _210: Int, +_211: Int, _212: Int, _213: Int, _214: Int, _215: Int, _216: Int, _217: Int, _218: Int, _219: Int, _220: Int, +_221: Int, _222: Int, _223: Int, _224: Int, _225: Int, _226: Int, _227: Int, _228: Int, _229: Int, _230: Int, +_231: Int, _232: Int, _233: Int, _234: Int, _235: Int, _236: Int, _237: Int, _238: Int, _239: Int, _240: Int, +_241: Int, _242: Int, _243: Int, _244: Int, _245: Int, _246: Int, _247: Int, _248: Int, _249: Int, _250: Int, +_251: Int, _252: Int, _253: Int, _254: Int, _255: Int +) + +class BarOK( +_1: Int, _2: Int, _3: Int, _4: Int, _5: Int, _6: Int, _7: Int, _8: Int, _9: Int, _10: Int, +_11: Int, _12: Int, _13: Int, _14: Int, _15: Int, _16: Int, _17: Int, _18: Int, _19: Int, _20: Int, +_21: Int, _22: Int, _23: Int, _24: Int, _25: Int, _26: Int, _27: Int, _28: Int, _29: Int, _30: Int, +_31: Int, _32: Int, _33: Int, _34: Int, _35: Int, _36: Int, _37: Int, _38: Int, _39: Int, _40: Int, +_41: Int, _42: Int, _43: Int, _44: Int, _45: Int, _46: Int, _47: Int, _48: Int, _49: Int, _50: Int, +_51: Int, _52: Int, _53: Int, _54: Int, _55: Int, _56: Int, _57: Int, _58: Int, _59: Int, _60: Int, +_61: Int, _62: Int, _63: Int, _64: Int, _65: Int, _66: Int, _67: Int, _68: Int, _69: Int, _70: Int, +_71: Int, _72: Int, _73: Int, _74: Int, _75: Int, _76: Int, _77: Int, _78: Int, _79: Int, _80: Int, +_81: Int, _82: Int, _83: Int, _84: Int, _85: Int, _86: Int, _87: Int, _88: Int, _89: Int, _90: Int, +_91: Int, _92: Int, _93: Int, _94: Int, _95: Int, _96: Int, _97: Int, _98: Int, _99: Int, _100: Int, +_101: Int, _102: Int, _103: Int, _104: Int, _105: Int, _106: Int, _107: Int, _108: Int, _109: Int, _110: Int, +_111: Int, _112: Int, _113: Int, _114: Int, _115: Int, _116: Int, _117: Int, _118: Int, _119: Int, _120: Int, +_121: Int, _122: Int, _123: Int, _124: Int, _125: Int, _126: Int, _127: Int, _128: Int, _129: Int, _130: Int, +_131: Int, _132: Int, _133: Int, _134: Int, _135: Int, _136: Int, _137: Int, _138: Int, _139: Int, _140: Int, +_141: Int, _142: Int, _143: Int, _144: Int, _145: Int, _146: Int, _147: Int, _148: Int, _149: Int, _150: Int, +_151: Int, _152: Int, _153: Int, _154: Int, _155: Int, _156: Int, _157: Int, _158: Int, _159: Int, _160: Int, +_161: Int, _162: Int, _163: Int, _164: Int, _165: Int, _166: Int, _167: Int, _168: Int, _169: Int, _170: Int, +_171: Int, _172: Int, _173: Int, _174: Int, _175: Int, _176: Int, _177: Int, _178: Int, _179: Int, _180: Int, +_181: Int, _182: Int, _183: Int, _184: Int, _185: Int, _186: Int, _187: Int, _188: Int, _189: Int, _190: Int, +_191: Int, _192: Int, _193: Int, _194: Int, _195: Int, _196: Int, _197: Int, _198: Int, _199: Int, _200: Int, +_201: Int, _202: Int, _203: Int, _204: Int, _205: Int, _206: Int, _207: Int, _208: Int, _209: Int, _210: Int, +_211: Int, _212: Int, _213: Int, _214: Int, _215: Int, _216: Int, _217: Int, _218: Int, _219: Int, _220: Int, +_221: Int, _222: Int, _223: Int, _224: Int, _225: Int, _226: Int, _227: Int, _228: Int, _229: Int, _230: Int, +_231: Int, _232: Int, _233: Int, _234: Int, _235: Int, _236: Int, _237: Int, _238: Int, _239: Int, _240: Int, +_241: Int, _242: Int, _243: Int, _244: Int, _245: Int, _246: Int, _247: Int, _248: Int, _249: Int, _250: Int, +_251: Int, _252: Int, _253: Int, _254: Int) diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check index af0154fe60..804b365101 100644 --- a/test/files/presentation/callcc-interpreter.check +++ b/test/files/presentation/callcc-interpreter.check @@ -69,13 +69,13 @@ retrieved 63 members askType at CallccInterpreter.scala(14,21) ================================================================================ [response] askTypeAt at (14,21) -def unitM[A >: Nothing <: Any](a: A): callccInterpreter.M[A] = callccInterpreter.this.M.apply[A](((c: A => callccInterpreter.Answer) => c.apply(a))) +def unitM[A](a: A): callccInterpreter.M[A] = callccInterpreter.this.M.apply[A](((c: A => callccInterpreter.Answer) => c.apply(a))) ================================================================================ askType at CallccInterpreter.scala(16,12) ================================================================================ [response] askTypeAt at (16,12) -def id[A >: Nothing <: Any]: A => A = ((x: A) => x) +def id[A]: A => A = ((x: A) => x) ================================================================================ askType at CallccInterpreter.scala(17,25) diff --git a/test/files/run/analyzerPlugins.check b/test/files/run/analyzerPlugins.check index 297bd36bae..641fbfff6b 100644 --- a/test/files/run/analyzerPlugins.check +++ b/test/files/run/analyzerPlugins.check @@ -25,13 +25,13 @@ pluginsPt(?, Trees$Assign) [7] pluginsPt(?, Trees$Block) [4] pluginsPt(?, Trees$ClassDef) [2] pluginsPt(?, Trees$DefDef) [14] -pluginsPt(?, Trees$Ident) [51] +pluginsPt(?, Trees$Ident) [50] pluginsPt(?, Trees$If) [2] pluginsPt(?, Trees$Literal) [16] pluginsPt(?, Trees$New) [5] pluginsPt(?, Trees$PackageDef) [1] pluginsPt(?, Trees$Return) [1] -pluginsPt(?, Trees$Select) [52] +pluginsPt(?, Trees$Select) [48] pluginsPt(?, Trees$Super) [2] pluginsPt(?, Trees$This) [20] pluginsPt(?, Trees$TypeApply) [4] @@ -112,7 +112,6 @@ pluginsTyped(<notype>, Trees$DefDef) [14] pluginsTyped(<notype>, Trees$PackageDef) [1] pluginsTyped(<notype>, Trees$TypeDef) [1] pluginsTyped(<notype>, Trees$ValDef) [21] -pluginsTyped(<root>, Trees$Ident) [1] pluginsTyped(=> Boolean @testAnn, Trees$Select) [1] pluginsTyped(=> Double, Trees$Select) [4] pluginsTyped(=> Int, Trees$Select) [5] @@ -151,7 +150,6 @@ pluginsTyped(List[Any], Trees$Apply) [1] pluginsTyped(List[Any], Trees$Select) [1] pluginsTyped(List[Any], Trees$TypeTree) [3] pluginsTyped(Nothing, Trees$Return) [1] -pluginsTyped(Nothing, Trees$Select) [2] pluginsTyped(Object, Trees$Apply) [1] pluginsTyped(String @testAnn, Trees$Ident) [1] pluginsTyped(String @testAnn, Trees$Select) [1] @@ -185,8 +183,6 @@ pluginsTyped(scala.annotation.TypeConstraint, Trees$TypeTree) [2] pluginsTyped(scala.collection.immutable.List.type, Trees$Select) [2] pluginsTyped(scala.collection.immutable.StringOps, Trees$ApplyImplicitView) [2] pluginsTyped(scala.collection.mutable.WrappedArray[Any], Trees$Apply) [1] -pluginsTyped(scala.type, Trees$Ident) [1] -pluginsTyped(scala.type, Trees$Select) [1] pluginsTyped(str.type, Trees$Ident) [3] pluginsTyped(testAnn, Trees$Apply) [5] pluginsTyped(testAnn, Trees$Ident) [5] diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala index d55f9e4e83..3bfb8c7ac3 100644 --- a/test/files/run/bitsets.scala +++ b/test/files/run/bitsets.scala @@ -115,6 +115,24 @@ object TestMutable3 { println(s"b0:$b0") } +/*** +The memory requirements here are way beyond +what a test should exercise. + +object TestMutable4 { + import scala.collection.mutable.BitSet + + val bMax = BitSet(Int.MaxValue) + println(s"bMax:$bMax") + bMax.foreach(println) + + val bLarge = BitSet(2000000001) + println(s"bLarge:$bLarge") + + println(bMax == bLarge) +} +***/ + object TestImmutable { import scala.collection.immutable.BitSet @@ -190,6 +208,7 @@ object Test extends App { TestMutable TestMutable2 TestMutable3 + // TestMutable4 TestImmutable TestImmutable2 } diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check index f3a6bef215..50a0cadebf 100644 --- a/test/files/run/lub-visibility.check +++ b/test/files/run/lub-visibility.check @@ -8,7 +8,8 @@ scala> // should infer List[scala.collection.immutable.Seq[Nothing]] scala> // but reverted that for SI-5534. scala> val x = List(List(), Vector()) -x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]; def takeRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]; def drop(n: Int): scala.collecti... +x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing] with java.io.Serializable] = List(List(), Vector()) + scala> scala> diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index 29a881f8b1..e0e880ab66 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -7,7 +7,7 @@ $treecreator1.super.<init>(); () }; - def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.Literal.apply($u.Constant.apply(2)) @@ -20,7 +20,7 @@ $typecreator2.super.<init>(); () }; - def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.ConstantType.apply($u.Constant.apply(2)) diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 75fd693722..347dfec1dc 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -7,7 +7,7 @@ $treecreator1.super.<init>(); () }; - def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.Apply.apply($u.Select.apply($u.build.Ident($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) @@ -20,7 +20,7 @@ $typecreator2.super.<init>(); () }; - def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) diff --git a/test/files/run/reify-each-node-type.check b/test/files/run/reify-each-node-type.check index af6fd13a7b..afc65add7a 100644 --- a/test/files/run/reify-each-node-type.check +++ b/test/files/run/reify-each-node-type.check @@ -15,7 +15,7 @@ 15 { def f(x: Any): Unit = (); () } EmptyTree 16 (null: r.D with r.E) CompoundTypeTree 17 { type T = Int; () } TypeDef -18 { type CC[T >: Nothing <: r.D] = r.C[T]; () } TypeBoundsTree +18 { type CC[T <: r.D] = r.C[T]; () } TypeBoundsTree 19 try { 0 } finally Predef.println("") Try 20 ((x: Int) => x) Function 21 { var v = 1; v = 2 } Assign @@ -24,7 +24,7 @@ 24 0: @unchecked Annotated 25 (null: r.Outer#Inner) SelectFromTypeTree 26 (null: Nil.type) SingletonTypeTree -27 (null: T forSome { type T >: Nothing <: Any }) ExistentialTypeTree +27 (null: T forSome { type T }) ExistentialTypeTree 28 { import r.{A, B=>C}; () } Import 29 { def f: Int = return 0; () } Return 30 { object x extends AnyRef { def <init>() = { super.<init>(); ModuleDef diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check index 99a966f38b..71841ff83b 100644 --- a/test/files/run/reify_ann1a.check +++ b/test/files/run/reify_ann1a.check @@ -1,5 +1,5 @@ { - @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T >: Nothing <: Any] extends AnyRef { + @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T] extends AnyRef { @new ann(List.apply("3a")) @new ann(List.apply("3b")) <paramaccessor> private[this] val x: T @ann(List.apply("4a")) @ann(List.apply("4b")) = _; def <init>(@new ann(List.apply("3a")) @new ann(List.apply("3b")) x: T @ann(List.apply("4a")) @ann(List.apply("4b"))) = { super.<init>(); diff --git a/test/files/run/reify_ann1b.check b/test/files/run/reify_ann1b.check index 6a5f32a492..bc046a7455 100644 --- a/test/files/run/reify_ann1b.check +++ b/test/files/run/reify_ann1b.check @@ -1,5 +1,5 @@ { - @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T >: Nothing <: Any] extends AnyRef { + @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T] extends AnyRef { @new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _; def <init>(@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = { super.<init>(); diff --git a/test/files/run/reify_ann2a.check b/test/files/run/reify_ann2a.check index ccbcb4c31e..a26fa42045 100644 --- a/test/files/run/reify_ann2a.check +++ b/test/files/run/reify_ann2a.check @@ -6,7 +6,7 @@ () } }; - @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T >: Nothing <: Any] extends AnyRef { + @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T] extends AnyRef { @new ann(List.apply("3a")) @new ann(List.apply("3b")) <paramaccessor> private[this] val x: T @ann(List.apply("4a")) @ann(List.apply("4b")) = _; def <init>(@new ann(List.apply("3a")) @new ann(List.apply("3b")) x: T @ann(List.apply("4a")) @ann(List.apply("4b"))) = { super.<init>(); diff --git a/test/files/run/reify_ann3.check b/test/files/run/reify_ann3.check index 8caceb2696..d4cf660758 100644 --- a/test/files/run/reify_ann3.check +++ b/test/files/run/reify_ann3.check @@ -1,5 +1,5 @@ { - class Tree[A >: Nothing <: Any, B >: Nothing <: Any] extends AnyRef { + class Tree[A, B] extends AnyRef { @new inline @getter() final <paramaccessor> val key: A = _; def <init>(key: A) = { super.<init>(); diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index 27be3eb67d..002316fd54 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -79,7 +79,7 @@ TypeRef( ) TypeRef( TypeSymbol( - sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable ) args = List( @@ -146,7 +146,7 @@ TypeRef( args = List( TypeRef( TypeSymbol( - sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable ) args = List( @@ -179,7 +179,7 @@ PolyType( args = List( TypeRef( TypeSymbol( - sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable ) args = List(TypeParamTypeRef(TypeParam(T <: AnyVal))) @@ -202,7 +202,7 @@ PolyType( params = List(TermSymbol(x: T), TermSymbol(y: List[U])) resultType = TypeRef( TypeSymbol( - sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable ) args = List(TypeParamTypeRef(TypeParam(U >: T))) diff --git a/test/files/run/t2251b.check b/test/files/run/t2251b.check index 42b0be457a..5fa5d5168c 100644 --- a/test/files/run/t2251b.check +++ b/test/files/run/t2251b.check @@ -6,6 +6,6 @@ TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G w TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]] TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] TypeTag[List[scala.collection.Map[_ >: F with C <: B[_ >: F with C <: B[_ >: F with C <: A]], B[_ >: G with D <: B[_ >: G with D <: A]]]]] -TypeTag[List[scala.collection.AbstractSeq[B[_ >: G with F <: B[_ >: G with F <: A]]] with scala.collection.LinearSeq[B[_ >: G with F <: B[_ >: G with F <: A]]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def drop(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def take(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def slice(from: Int,until: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}}]] +TypeTag[List[scala.collection.AbstractSeq[B[_ >: G with F <: B[_ >: G with F <: A]]] with scala.collection.LinearSeq[B[_ >: G with F <: B[_ >: G with F <: A]]] with java.io.Serializable]] TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala index 4846fa31b4..38190cfa5c 100644 --- a/test/files/run/t4023.scala +++ b/test/files/run/t4023.scala @@ -7,17 +7,28 @@ object Test { object B5 extends B1 private object B6 extends B2 - val valuesTry1 = this.getClass.getDeclaredClasses - val valuesTry2 = C.getClass.getDeclaredClasses - val valuesTry3 = getClass.getDeclaredClasses + val classes1 = this.getClass.getDeclaredClasses + val classes2 = C.getClass .getDeclaredClasses + val classes3 = getClass .getDeclaredClasses + } + + // sortBy(_.getName) introduces additional classes which we don't want to see in C, + // so we call sortBy outside of C. + object TestHelper { + val valuesTry1 = C.classes1.sortBy(_.getName) + val valuesTry2 = C.classes2.sortBy(_.getName) + val valuesTry3 = C.classes3.sortBy(_.getName) } def main(args: Array[String]) { - println("Try 1: (" + C.valuesTry1.length + " classes)") - C.valuesTry1.foreach(println) - println("Try 2: (" + C.valuesTry2.length + " classes)") - C.valuesTry2.foreach(println) - println("Try 3: (" + C.valuesTry3.length + " classes)") - C.valuesTry3.foreach(println) + println("Try 1: (" + TestHelper.valuesTry1.length + " classes)") + TestHelper.valuesTry1.foreach(println) + println("Try 2: (" + TestHelper.valuesTry2.length + " classes)") + TestHelper.valuesTry2.foreach(println) + println("Try 3: (" + TestHelper.valuesTry3.length + " classes)") + TestHelper.valuesTry3.foreach(println) } -}
\ No newline at end of file + + +} + diff --git a/test/scaladoc/run/t5527.check b/test/scaladoc/run/t5527.check index ab2aeb2d67..8483460d04 100644 --- a/test/scaladoc/run/t5527.check +++ b/test/scaladoc/run/t5527.check @@ -1,12 +1,12 @@ -newSource1:17: warning: discarding unmoored doc comment - /** Testing 123 */ - ^ -newSource1:27: warning: discarding unmoored doc comment - /** Calculate this result. */ +newSource1:47: warning: discarding unmoored doc comment + /** Document this crucial constant for posterity. ^ -newSource1:34: warning: discarding unmoored doc comment - /** Another digit is a giveaway. */ +newSource1:64: warning: discarding unmoored doc comment + /*************************\ ^ +newSource1:73: warning: discarding unmoored doc comment + val i = 10 */** Important! + ^ [[syntax trees at end of parser]] // newSource1 package <empty> { object UselessComments extends scala.AnyRef { @@ -48,6 +48,26 @@ package <empty> { val test4 = 'a' match { case ('0'| '1'| '2'| '3'| '4'| '5'| '6'| '7'| '8'| '9') => true case _ => false + }; + def test5: scala.Unit = if (true) + $qmark$qmark$qmark + else + (); + def test6 = { + val u = 4; + 0.to(u).foreach(((i) => println(i))) + }; + def test7 = { + val u = 4; + 0.to(u).foreach(((i) => println(i))) + }; + def test8 = { + val z = "fancy"; + z.replace("fanc", "arts") + }; + def test9 = { + val i = 10.$times(10); + assert(i.$eq$eq(100)) } }; /** comments that we should keep */ @@ -75,7 +95,7 @@ package <empty> { () }; /** T */ - type T >: _root_.scala.Nothing <: _root_.scala.Any; + type T; /** f */ def f(i: Int): scala.Unit; /** v */ @@ -102,7 +122,11 @@ package <empty> { super.<init>(); () } - } + }; + /** Get the simple value. + * @return the default value + */ + def value: Int = 7 } } diff --git a/test/scaladoc/run/t5527.scala b/test/scaladoc/run/t5527.scala index 2449ff60c3..60ae23c1a7 100644 --- a/test/scaladoc/run/t5527.scala +++ b/test/scaladoc/run/t5527.scala @@ -49,6 +49,47 @@ object Test extends DirectTest { case _ => false } + + def test5 { + /** @martin is this right? It shouldn't flag me as scaladoc. */ + if (true) ??? + } + + def test6 = { + /** Document this crucial constant for posterity. + * Don't forget to dedoc this comment if you refactor to a local. + * @author Paul Phillips + */ + val u = 4 + for (i <- 0 to u) + println(i) + } + def test7 = { + /** Some standard tags are tolerated locally and shouldn't trigger a warning. + * @note Don't change this unless you know what you're doing. This means you. + */ + val u = 4 + for (i <- 0 to u) + println(i) + } + def test8 = { + /*************************\ + * Fancy ASCII Art Block * + * @author som-snytt * + \*************************/ + // this is just a local + val z = "fancy" + z replace ("fanc", "arts") + } + def test9 = { + val i = 10 */** Important! + * We have to multiply here! + * @author community + * @see SI-1234 + */ + 10 + assert(i == 100) + } } /** comments that we should keep */ @@ -85,6 +126,13 @@ object Test extends DirectTest { /** class D */ @deprecated("use ... instead", "2.10.0") class D + + /** Get the simple value. + * @return the default value + */ + // an intervening line comment + /* I had more to say, but didn't want to pollute the scaladoc. */ + def value: Int = 7 } """.trim |