diff options
Diffstat (limited to 'src')
35 files changed, 66 insertions, 72 deletions
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index 13bf0ef4c6..f46f014096 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -131,7 +131,7 @@ class Scalac extends ScalaMatchingTask with ScalacShared { /** The character encoding of the files to compile. */ protected var encoding: Option[String] = None - // the targetted backend + // the targeted backend protected var backend: Option[String] = None /** Whether to force compilation of all files or not. */ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala index 1cbf081b7c..93f5159f89 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala @@ -292,7 +292,7 @@ final class BCodeAsmCommon[G <: Global](val global: G) { lazy val AnnotationRetentionPolicyRuntimeValue = AnnotationRetentionPolicyModule.tpe.member(TermName("RUNTIME")) /** Whether an annotation should be emitted as a Java annotation - * .initialize: if 'annot' is read from pickle, atp might be un-initialized + * .initialize: if 'annot' is read from pickle, atp might be uninitialized */ def shouldEmitAnnotation(annot: AnnotationInfo) = { annot.symbol.initialize.isJavaDefined && diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index 2297faab6a..a9b6a312e9 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala @@ -443,7 +443,7 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { * which rethrows the caught exception once it's done with the cleanup code. * * A particular cleanup may in general contain LabelDefs. Care is needed when duplicating such jump-targets, - * so as to preserve agreement wit the (also duplicated) jump-sources. + * so as to preserve agreement with the (also duplicated) jump-sources. * This is achieved based on the bookkeeping provided by two maps: * - `labelDefsAtOrUnder` lists all LabelDefs enclosed by a given Tree node (the key) * - `labelDef` provides the LabelDef node whose symbol is used as key. diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 8348306e03..7096f16d75 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -3028,7 +3028,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self => * * Rationale for this normalization: * test/files/run/private-inline.scala after -optimize is chock full of - * BasicBlocks containing just JUMP(whereTo), where no exception handler straddles them. + * BasicBlocks containing just JUMP(whereto), where no exception handler straddles them. * They should be collapsed by IMethod.normalize() but aren't. * That was fine in FJBG times when by the time the exception table was emitted, * it already contained "anchored" labels (ie instruction offsets were known) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala index bd5bab28b5..4132710a96 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala @@ -31,7 +31,7 @@ import scala.tools.nsc.backend.jvm.opt.BytecodeUtils._ * catch block, and the recursive invocation is not necessary. * * simplify jumps - * - various simplifications, see doc domments of individual optimizations + * - various simplifications, see doc comments of individual optimizations * + changing or eliminating jumps may render some code unreachable, therefore "simplify jumps" is * executed in a loop with "unreachable code" * @@ -495,7 +495,7 @@ object LocalOptImpls { * Replace jumps to a sequence of GOTO instructions by a jump to the final destination. * * Jump l; [any ops]; l: GOTO m; [any ops]; m: GOTO n; [any ops]; n: NotGOTO; [...] - * => Jump n; [rest unchaned] + * => Jump n; [rest unchanged] * * If there's a loop of GOTOs, the initial jump is replaced by one of the labels in the loop. */ diff --git a/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala index 425c10d153..9f6883f03f 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala @@ -343,7 +343,7 @@ abstract class InlineExceptionHandlers extends SubComponent { /** * This function takes care of duplicating the basic block code for inlining the handler * - * Note: This function does not duplicate the same basic block twice. It wil contain a map of the duplicated + * Note: This function does not duplicate the same basic block twice. It will contain a map of the duplicated * basic blocks */ private def duplicateExceptionHandlerCache(handler: BasicBlock) = diff --git a/src/compiler/scala/tools/nsc/plugins/Plugin.scala b/src/compiler/scala/tools/nsc/plugins/Plugin.scala index 1a5529140c..dd17750cd4 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugin.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugin.scala @@ -158,8 +158,8 @@ object Plugin { def loop(qs: List[Path]): Try[PluginDescription] = qs match { case Nil => Failure(new MissingPluginException(ps)) case p :: rest => - if (p.isDirectory) loadDescriptionFromFile(p.toDirectory / PluginXML) - else if (p.isFile) loadDescriptionFromJar(p.toFile) + if (p.isDirectory) loadDescriptionFromFile(p.toDirectory / PluginXML) orElse loop(rest) + else if (p.isFile) loadDescriptionFromJar(p.toFile) orElse loop(rest) else loop(rest) } loop(ps) diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 86685d46de..7c66bda46b 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -165,11 +165,19 @@ abstract class Constructors extends Statics with Transform with ast.TreeDSL { return } + // Note: elision of outer reference is based on a class-wise analysis, if a class might have subclasses, + // it doesn't work. For example, `LocalParent` retains the outer reference in: + // + // class Outer { def test = {class LocalParent; class LocalChild extends LocalParent } } + // + // See run/t9408.scala for related test cases. + val isEffectivelyFinal = clazz.isEffectivelyFinal def isParamCandidateForElision(sym: Symbol) = (sym.isParamAccessor && sym.isPrivateLocal) - def isOuterCandidateForElision(sym: Symbol) = (sym.isOuterAccessor && sym.owner.isEffectivelyFinal && !sym.isOverridingSymbol) + def isOuterCandidateForElision(sym: Symbol) = (sym.isOuterAccessor && isEffectivelyFinal && !sym.isOverridingSymbol) - val paramCandidatesForElision: Set[ /*Field*/ Symbol] = (clazz.info.decls.toSet filter isParamCandidateForElision) - val outerCandidatesForElision: Set[ /*Method*/ Symbol] = (clazz.info.decls.toSet filter isOuterCandidateForElision) + val decls = clazz.info.decls.toSet + val paramCandidatesForElision: Set[ /*Field*/ Symbol] = (decls filter isParamCandidateForElision) + val outerCandidatesForElision: Set[ /*Method*/ Symbol] = (decls filter isOuterCandidateForElision) omittables ++= paramCandidatesForElision omittables ++= outerCandidatesForElision diff --git a/src/compiler/scala/tools/nsc/transform/LazyVals.scala b/src/compiler/scala/tools/nsc/transform/LazyVals.scala index df622d4d1d..b6695efb0b 100644 --- a/src/compiler/scala/tools/nsc/transform/LazyVals.scala +++ b/src/compiler/scala/tools/nsc/transform/LazyVals.scala @@ -168,7 +168,7 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD /** Add the bitmap definitions to the rhs of a method definition. * If the rhs has been tail-call transformed, insert the bitmap * definitions inside the top-level label definition, so that each - * iteration has the lazy values un-initialized. Otherwise add them + * iteration has the lazy values uninitialized. Otherwise add them * at the very beginning of the method. */ private def addBitmapDefs(methSym: Symbol, rhs: Tree): Tree = { diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 11f9483f77..25d45cc819 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -79,9 +79,9 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { /** Does this field require an initialized bit? * Note: fields of classes inheriting DelayedInit are not checked. - * This is because the they are neither initialized in the constructor + * This is because they are neither initialized in the constructor * nor do they have a setter (not if they are vals anyway). The usual - * logic for setting bitmaps does therefor not work for such fields. + * logic for setting bitmaps does therefore not work for such fields. * That's why they are excluded. * Note: The `checkinit` option does not check if transient fields are initialized. */ diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 65316e4f00..72e2174bf8 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -433,7 +433,7 @@ abstract class UnCurry extends InfoTransform val sym = tree.symbol - // true if the taget is a lambda body that's been lifted into a method + // true if the target is a lambda body that's been lifted into a method def isLiftedLambdaBody(target: Tree) = target.symbol.isLocalToBlock && target.symbol.isArtifact && target.symbol.name.containsName(nme.ANON_FUN_NAME) val result = ( diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala index a11906ace1..00de77a8d4 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala @@ -138,7 +138,7 @@ trait TreeAndTypeAnalysis extends Debugging { if(grouped) { def enumerateChildren(sym: Symbol) = { - sym.children.toList + sym.sealedChildren.toList .sortBy(_.sealedSortName) .filterNot(x => x.isSealed && x.isAbstractClass && !isPrimitiveValueClass(x)) } diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchCodeGen.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchCodeGen.scala index 06b39b035a..1642613b9b 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchCodeGen.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchCodeGen.scala @@ -134,7 +134,7 @@ trait MatchCodeGen extends Interface { trait OptimizedCodegen extends CodegenCore with TypedSubstitution with MatchMonadInterface { override def codegen: AbsCodegen = optimizedCodegen - // when we know we're targetting Option, do some inlining the optimizer won't do + // when we know we're targeting Option, do some inlining the optimizer won't do // for example, `o.flatMap(f)` becomes `if(o == None) None else f(o.get)`, similarly for orElse and guard // this is a special instance of the advanced inlining optimization that takes a method call on // an object of a type that only has two concrete subclasses, and inlines both bodies, guarded by an if to distinguish the two cases diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala index b3aef8a20e..cca8d2dbb8 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala @@ -286,8 +286,8 @@ trait MatchOptimization extends MatchTreeMaking with MatchAnalysis { else Apply(Ident(defaultLabel), Nil) val guardedBody = same.foldRight(jumpToDefault){ - // the last case may be un-guarded (we know it's the last one since fold's accum == jumpToDefault) - // --> replace jumpToDefault by the un-guarded case's body + // the last case may be unguarded (we know it's the last one since fold's accum == jumpToDefault) + // --> replace jumpToDefault by the unguarded case's body case (CaseDef(_, EmptyTree, b), `jumpToDefault`) => b case (cd@CaseDef(_, g, b), els) if isGuardedCase(cd) => If(g, b, els) } @@ -322,7 +322,7 @@ trait MatchOptimization extends MatchTreeMaking with MatchAnalysis { var remainingCases = cases val collapsed = scala.collection.mutable.ListBuffer.empty[CaseDef] - // when some of collapsed cases (except for the default case itself) did not include an un-guarded case + // when some of collapsed cases (except for the default case itself) did not include an unguarded case // we'll need to emit a labeldef for the default case var needDefault = false diff --git a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala index fc632e0d0d..8bcd5e6f12 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala @@ -212,8 +212,8 @@ trait Checkable { ) /** Are all children of these symbols pairwise irreconcilable? */ def allChildrenAreIrreconcilable(sym1: Symbol, sym2: Symbol) = ( - sym1.children.toList forall (c1 => - sym2.children.toList forall (c2 => + sym1.sealedChildren.toList forall (c1 => + sym2.sealedChildren.toList forall (c2 => areIrreconcilableAsParents(c1, c2) ) ) diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index fa266d43ed..2ccf375c45 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -168,13 +168,13 @@ trait Contexts { self: Analyzer => * fine grained control is needed based on the kind of error; ambiguity errors are often * suppressed during exploratory typing, such as determining whether `a == b` in an argument * position is an assignment or a named argument, when `Inferencer#isApplicableSafe` type checks - * applications with and without an expected type, or whtn `Typer#tryTypedApply` tries to fit arguments to + * applications with and without an expected type, or when `Typer#tryTypedApply` tries to fit arguments to * a function type with/without implicit views. * - * When the error policies entails error/warning buffering, the mutable [[ReportBuffer]] records + * When the error policies entail error/warning buffering, the mutable [[ReportBuffer]] records * everything that is issued. It is important to note, that child Contexts created with `make` * "inherit" the very same `ReportBuffer` instance, whereas children spawned through `makeSilent` - * receive an separate, fresh buffer. + * receive a separate, fresh buffer. * * @param tree Tree associated with this context * @param owner The current owner diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index beaf3432b4..196b137a3e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1358,7 +1358,7 @@ trait Implicits { val succstart = if (stats) Statistics.startTimer(oftypeSucceedNanos) else null // SI-6667, never search companions after an ambiguous error in in-scope implicits - val wasAmbigious = result.isAmbiguousFailure + val wasAmbiguous = result.isAmbiguousFailure // TODO: encapsulate val previousErrs = context.reporter.errors @@ -1368,7 +1368,7 @@ trait Implicits { // `materializeImplicit` does some preprocessing for `pt` // is it only meant for manifests/tags or we need to do the same for `implicitsOfExpectedType`? - if (result.isFailure && !wasAmbigious) + if (result.isFailure && !wasAmbiguous) result = searchImplicit(implicitsOfExpectedType, isLocalToCallsite = false) if (result.isFailure) diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index a4c794e8cf..bf705e89ad 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1117,7 +1117,7 @@ trait Infer extends Checkable { // this is quite nasty: it destructively changes the info of the syms of e.g., method type params // (see #3692, where the type param T's bounds were set to > : T <: T, so that parts looped) - // the changes are rolled back by restoreTypeBounds, but might be unintentially observed in the mean time + // the changes are rolled back by restoreTypeBounds, but might be unintentionally observed in the mean time def instantiateTypeVar(tvar: TypeVar) { val tparam = tvar.origin.typeSymbol val TypeBounds(lo0, hi0) = tparam.info.bounds diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index d86a72c1a8..0198529ef7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1134,13 +1134,13 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans t hasSymbolWhich (_.accessedOrSelf == valOrDef.symbol) case _ => false } - val trivialInifiniteLoop = ( + val trivialInfiniteLoop = ( !valOrDef.isErroneous && !valOrDef.symbol.isValueParameter && valOrDef.symbol.paramss.isEmpty && callsSelf ) - if (trivialInifiniteLoop) + if (trivialInfiniteLoop) reporter.warning(valOrDef.rhs.pos, s"${valOrDef.symbol.fullLocationString} does nothing other than call itself recursively") } diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 2dfecbaea1..cc15a2485f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1694,6 +1694,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper psym addChild context.owner else pending += ParentSealedInheritanceError(parent, psym) + if (psym.isLocalToBlock && !phase.erasedTypes) + psym addChild context.owner val parentTypeOfThis = parent.tpe.dealias.typeOfThis if (!(selfType <:< parentTypeOfThis) && @@ -4564,7 +4566,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper typed1(atPos(tree.pos)(Block(stats, Apply(expr, args) setPos tree.pos.makeTransparent)), mode, pt) case Apply(fun, args) => normalTypedApply(tree, fun, args) match { - case ArrayInstantiation(tree1) => typed(tree1, mode, pt) + case ArrayInstantiation(tree1) => if (tree1.isErrorTyped) tree1 else typed(tree1, mode, pt) case Apply(Select(fun, nme.apply), _) if treeInfo.isSuperConstrCall(fun) => TooManyArgumentListsForConstructor(tree) //SI-5696 case tree1 => tree1 } diff --git a/src/intellij/interactive.iml.SAMPLE b/src/intellij/interactive.iml.SAMPLE index 047b5c9069..267bd3f12b 100644 --- a/src/intellij/interactive.iml.SAMPLE +++ b/src/intellij/interactive.iml.SAMPLE @@ -11,5 +11,6 @@ <orderEntry type="module" module-name="library" /> <orderEntry type="module" module-name="reflect" /> <orderEntry type="library" name="starr" level="project" /> + <orderEntry type="library" name="asm" level="project" /> </component> </module>
\ No newline at end of file diff --git a/src/intellij/repl.iml.SAMPLE b/src/intellij/repl.iml.SAMPLE index 7476f30131..e827a2c6d7 100644 --- a/src/intellij/repl.iml.SAMPLE +++ b/src/intellij/repl.iml.SAMPLE @@ -10,6 +10,7 @@ <orderEntry type="module" module-name="compiler" /> <orderEntry type="module" module-name="library" /> <orderEntry type="module" module-name="reflect" /> + <orderEntry type="module" module-name="interactive" /> <orderEntry type="library" name="starr" level="project" /> <orderEntry type="library" name="repl-deps" level="project" /> <orderEntry type="library" name="asm" level="project" /> diff --git a/src/intellij/scaladoc.iml.SAMPLE b/src/intellij/scaladoc.iml.SAMPLE index 4ba0a848c6..6e6d98b396 100644 --- a/src/intellij/scaladoc.iml.SAMPLE +++ b/src/intellij/scaladoc.iml.SAMPLE @@ -14,5 +14,6 @@ <orderEntry type="library" name="scaladoc-deps" level="project" /> <orderEntry type="library" name="ant" level="project" /> <orderEntry type="library" name="partest" level="project" /> + <orderEntry type="library" name="asm" level="project" /> </component> </module>
\ No newline at end of file diff --git a/src/library-aux/scala/Any.scala b/src/library-aux/scala/Any.scala index 1c25989c30..1be186d114 100644 --- a/src/library-aux/scala/Any.scala +++ b/src/library-aux/scala/Any.scala @@ -38,7 +38,7 @@ abstract class Any { * - It is reflexive: for any instance `x` of type `Any`, `x.equals(x)` should return `true`. * - It is symmetric: for any instances `x` and `y` of type `Any`, `x.equals(y)` should return `true` if and * only if `y.equals(x)` returns `true`. - * - It is transitive: for any instances `x`, `y`, and `z` of type `AnyRef` if `x.equals(y)` returns `true` and + * - It is transitive: for any instances `x`, `y`, and `z` of type `Any` if `x.equals(y)` returns `true` and * `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`. * * If you override this method, you should verify that your implementation remains an equivalence relation. diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 281e056330..fa58015a84 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -269,13 +269,6 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef { @inline def formatted(fmtstr: String): String = fmtstr format self } - // TODO: remove, only needed for binary compatibility of 2.11.0-RC1 with 2.11.0-M8 - // note that `private[scala]` becomes `public` in bytecode - private[scala] final class StringAdd[A](private val self: A) extends AnyVal { - def +(other: String): String = String.valueOf(self) + other - } - private[scala] def StringAdd(x: Any): Any = new StringAdd(x) - // SI-8229 retaining the pre 2.11 name for source compatibility in shadowing this implicit implicit final class any2stringadd[A](private val self: A) extends AnyVal { def +(other: String): String = String.valueOf(self) + other diff --git a/src/library/scala/collection/convert/Wrappers.scala b/src/library/scala/collection/convert/Wrappers.scala index 9f9732c62f..c2da66a9bf 100644 --- a/src/library/scala/collection/convert/Wrappers.scala +++ b/src/library/scala/collection/convert/Wrappers.scala @@ -102,9 +102,9 @@ private[collection] trait Wrappers { override def clone(): JListWrapper[A] = JListWrapper(new ju.ArrayList[A](underlying)) } - // Note various overrides to avoid performance gotchas. - class SetWrapper[A](underlying: Set[A]) extends ju.AbstractSet[A] { - self => + @SerialVersionUID(1L) + class SetWrapper[A](underlying: Set[A]) extends ju.AbstractSet[A] with Serializable { self => + // Note various overrides to avoid performance gotchas. override def contains(o: Object): Boolean = { try { underlying.contains(o.asInstanceOf[A]) } catch { case cce: ClassCastException => false } @@ -165,7 +165,8 @@ private[collection] trait Wrappers { new JSetWrapper[A](new ju.LinkedHashSet[A](underlying)) } - class MapWrapper[A, B](underlying: Map[A, B]) extends ju.AbstractMap[A, B] { self => + @SerialVersionUID(1L) + class MapWrapper[A, B](underlying: Map[A, B]) extends ju.AbstractMap[A, B] with Serializable { self => override def size = underlying.size override def get(key: AnyRef): B = try { diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 0b380517f8..984ea7ba50 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -302,7 +302,7 @@ extends scala.collection.AbstractSeq[Int] */ final override def splitAt(n: Int) = (take(n), drop(n)) - /** Creates a new range consisting of the `length - n` last elements of the range. + /** Creates a new range consisting of the last `n` elements of the range. * * $doesNotUseBuilders */ diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala index 6c5b10e73b..1d0d40a1d8 100644 --- a/src/library/scala/collection/immutable/Stream.scala +++ b/src/library/scala/collection/immutable/Stream.scala @@ -509,21 +509,6 @@ self => else Stream.Empty } - /** Returns all the elements of this `Stream` that satisfy the predicate `p` - * in a new `Stream` - i.e., it is still a lazy data structure. The order of - * the elements is preserved - * - * @param p the predicate used to filter the stream. - * @return the elements of this stream satisfying `p`. - * - * @example {{{ - * $naturalsEx - * naturalsFrom(1) 10 } filter { _ % 5 == 0 } take 10 mkString(", ") - * // produces - * }}} - */ - override def filter(p: A => Boolean): Stream[A] = filterImpl(p, isFlipped = false) // This override is only left in 2.11 because of binary compatibility, see PR #3925 - /** A FilterMonadic which allows GC of the head of stream during processing */ @noinline // Workaround SI-9137, see https://github.com/scala/scala/pull/4284#issuecomment-73180791 override final def withFilter(p: A => Boolean): FilterMonadic[A, Stream[A]] = new Stream.StreamWithFilter(this, p) diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index ca83f5ef85..8a52f0b9d8 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -498,8 +498,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => * failure to the point when that name is used for something, which is * often to the point of never. */ - def newStubSymbol(name: Name, missingMessage: String): Symbol = name match { - case n: TypeName => new StubClassSymbol(this, n, missingMessage) + def newStubSymbol(name: Name, missingMessage: String, isPackage: Boolean = false): Symbol = name match { + case n: TypeName => if (isPackage) new StubPackageClassSymbol(this, n, missingMessage) else new StubClassSymbol(this, n, missingMessage) case _ => new StubTermSymbol(this, name.toTermName, missingMessage) } @@ -983,7 +983,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => private def isNotOverridden = ( owner.isClass && ( owner.isEffectivelyFinal - || owner.isSealed && owner.children.forall(c => c.isEffectivelyFinal && (overridingSymbol(c) == NoSymbol)) + || (owner.isSealed && owner.sealedChildren.forall(c => c.isEffectivelyFinal && (overridingSymbol(c) == NoSymbol))) ) ) @@ -995,6 +995,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => isPrivate || isLocalToBlock ) + || isClass && originalOwner.isTerm && children.isEmpty // we track known subclasses of term-owned classes, use that infer finality ) /** Is this symbol effectively final or a concrete term member of sealed class whose children do not override it */ final def isEffectivelyFinalOrNotOverridden: Boolean = isEffectivelyFinal || (isTerm && !isDeferred && isNotOverridden) @@ -1162,7 +1163,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => * phase check (if after flatten) in the (overridden) method "def owner" in * ModuleSymbol / ClassSymbol. The `rawowner` field is not modified. * - Owners are also changed in other situations, for example when moving trees into a new - * lexical context, e.g. in the named/default arguments tranformation, or when translating + * lexical context, e.g. in the named/default arguments transformation, or when translating * extension method definitions. * * In general when seeking the owner of a symbol, one should call `owner`. @@ -2498,14 +2499,15 @@ trait Symbols extends api.Symbols { self: SymbolTable => def associatedFile: AbstractFile = enclosingTopLevelClass.associatedFile def associatedFile_=(f: AbstractFile) { abort("associatedFile_= inapplicable for " + this) } - /** If this is a sealed class, its known direct subclasses. + /** If this is a sealed or local class, its known direct subclasses. * Otherwise, the empty set. */ def children: Set[Symbol] = Set() + final def sealedChildren: Set[Symbol] = if (!isSealed) Set.empty else children /** Recursively assemble all children of this symbol. */ - def sealedDescendants: Set[Symbol] = children.flatMap(_.sealedDescendants) + this + final def sealedDescendants: Set[Symbol] = if (!isSealed) Set(this) else children.flatMap(_.sealedDescendants) + this @inline final def orElse(alt: => Symbol): Symbol = if (this ne NoSymbol) this else alt @inline final def andAlso(f: Symbol => Unit): Symbol = { if (this ne NoSymbol) f(this) ; this } @@ -3474,6 +3476,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => override def companionSymbol = fail(NoSymbol) } class StubClassSymbol(owner0: Symbol, name0: TypeName, val missingMessage: String) extends ClassSymbol(owner0, owner0.pos, name0) with StubSymbol + class StubPackageClassSymbol(owner0: Symbol, name0: TypeName, val missingMessage: String) extends PackageClassSymbol(owner0, owner0.pos, name0) with StubSymbol class StubTermSymbol(owner0: Symbol, name0: TermName, val missingMessage: String) extends TermSymbol(owner0, owner0.pos, name0) with StubSymbol trait FreeSymbol extends Symbol { diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala index 464bbad2cd..951c155de6 100644 --- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala +++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala @@ -397,7 +397,7 @@ abstract class UnPickler { val sym = readSymbolRef() match { case stub: StubSymbol if !stub.isClass => // SI-8502 This allows us to create a stub for a unpickled reference to `missingPackage.Foo`. - stub.owner.newStubSymbol(stub.name.toTypeName, stub.missingMessage) + stub.owner.newStubSymbol(stub.name.toTypeName, stub.missingMessage, isPackage = true) case sym => sym } ThisType(sym) diff --git a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala index 891fccb3e1..d6d216863b 100644 --- a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala +++ b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala @@ -739,7 +739,7 @@ private[internal] trait TypeMaps { substFor(sym) case ClassInfoType(parents, decls, sym) => val parents1 = parents mapConserve this - // We don't touch decls here; they will be touched when an enclosing TreeSubstitutor + // We don't touch decls here; they will be touched when an enclosing TreeSubstituter // transforms the tree that defines them. if (parents1 eq parents) tp else ClassInfoType(parents1, decls, sym) diff --git a/src/reflect/scala/reflect/internal/transform/Erasure.scala b/src/reflect/scala/reflect/internal/transform/Erasure.scala index 5a03c1eeaa..9853a0fa0c 100644 --- a/src/reflect/scala/reflect/internal/transform/Erasure.scala +++ b/src/reflect/scala/reflect/internal/transform/Erasure.scala @@ -90,7 +90,7 @@ trait Erasure { } } - /** Does this vakue class have an underlying type that's a type parameter of + /** Does this value class have an underlying type that's a type parameter of * the class itself? * This method needs to be called at a phase no later than erasurephase */ diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala index 99f989aadf..7978cbd137 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala @@ -682,7 +682,6 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp if (diagramSvg != NodeSeq.Empty) { <div class="toggleContainer block diagram-container" id={ id + "-container"}> <span class="toggle diagram-link">{ description }</span> - <a href="http://docs.scala-lang.org/overviews/scaladoc/usage.html#diagrams" target="_blank" class="diagram-help">Learn more about scaladoc diagrams</a> <div class="diagram" id={ id }>{ diagramSvg }</div> diff --git a/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala index fe157c1cc9..66ce2137f2 100644 --- a/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala @@ -31,7 +31,7 @@ trait CommentFactory extends base.CommentFactoryBase { defineComment(sym, linkTarget, inTpl) }) - /** A comment is usualy created by the parser, however for some special + /** A comment is usually created by the parser, however for some special * cases we have to give some `inTpl` comments (parent class for example) * to the comment of the symbol. * This function manages some of those cases : Param accessor and Primary constructor */ diff --git a/src/scaladoc/scala/tools/nsc/doc/model/diagram/Diagram.scala b/src/scaladoc/scala/tools/nsc/doc/model/diagram/Diagram.scala index 1846f375cd..e15963bda9 100644 --- a/src/scaladoc/scala/tools/nsc/doc/model/diagram/Diagram.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/diagram/Diagram.scala @@ -99,7 +99,7 @@ case class NormalNode(tpe: TypeEntity, tpl: Option[TemplateEntity])(val tooltip: /** A class or trait the thisnode can be converted to by an implicit conversion * TODO: I think it makes more sense to use the tpe links to templates instead of the TemplateEntity for implicit nodes - * since some implicit conversions convert the class to complex types that cannot be represented as a single tmeplate + * since some implicit conversions convert the class to complex types that cannot be represented as a single template */ case class ImplicitNode(tpe: TypeEntity, tpl: Option[TemplateEntity])(val tooltip: Option[String] = None) extends Node { override def isImplicitNode = true } |