From c32ba936ac4f7c0e9f815fadeec84294354567be Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Tue, 30 Jun 2015 11:15:50 -0700 Subject: SI-9370 Xplugin scans plugin path for descriptor Keep on scanning if the first entry doesn't yield a plugin.xml descriptor. --- src/compiler/scala/tools/nsc/plugins/Plugin.scala | 4 +-- test/files/pos/t9370/ThePlugin.scala | 31 +++++++++++++++++++++++ test/files/pos/t9370/sample_2.flags | 1 + test/files/pos/t9370/sample_2.scala | 6 +++++ test/files/pos/t9370/scalac-plugin.xml | 5 ++++ 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 test/files/pos/t9370/ThePlugin.scala create mode 100644 test/files/pos/t9370/sample_2.flags create mode 100644 test/files/pos/t9370/sample_2.scala create mode 100644 test/files/pos/t9370/scalac-plugin.xml 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/test/files/pos/t9370/ThePlugin.scala b/test/files/pos/t9370/ThePlugin.scala new file mode 100644 index 0000000000..cd800781dc --- /dev/null +++ b/test/files/pos/t9370/ThePlugin.scala @@ -0,0 +1,31 @@ +package scala.test.plugins + +import scala.tools.nsc +import nsc.Global +import nsc.Phase +import nsc.plugins.Plugin +import nsc.plugins.PluginComponent + +class ThePlugin(val global: Global) extends Plugin { + import global._ + + val name = "timebomb" + val description = "Explodes if run. Maybe I haven't implemented it yet." + val components = List[PluginComponent](thePhase1) + + private object thePhase1 extends PluginComponent { + val global = ThePlugin.this.global + + val runsAfter = List[String]("parser") + override val runsBefore = List[String]("namer") + val phaseName = ThePlugin.this.name + + def newPhase(prev: Phase) = new ThePhase(prev) + } + + private class ThePhase(prev: Phase) extends Phase(prev) { + override def name = ThePlugin.this.name + override def run = ??? + } +} + diff --git a/test/files/pos/t9370/sample_2.flags b/test/files/pos/t9370/sample_2.flags new file mode 100644 index 0000000000..03baca3030 --- /dev/null +++ b/test/files/pos/t9370/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:/tmp:. -Xplugin-require:timebomb -Ystop-after:parser diff --git a/test/files/pos/t9370/sample_2.scala b/test/files/pos/t9370/sample_2.scala new file mode 100644 index 0000000000..7eb11b8204 --- /dev/null +++ b/test/files/pos/t9370/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the explosive plugin disabled +object Sample extends App { +} diff --git a/test/files/pos/t9370/scalac-plugin.xml b/test/files/pos/t9370/scalac-plugin.xml new file mode 100644 index 0000000000..2558d6fd03 --- /dev/null +++ b/test/files/pos/t9370/scalac-plugin.xml @@ -0,0 +1,5 @@ + + ignored + scala.test.plugins.ThePlugin + + -- cgit v1.2.3 From 30d4f0165f362ce5ee055a0254190e7fd5793f40 Mon Sep 17 00:00:00 2001 From: Parambir Singh Date: Thu, 9 Jul 2015 12:43:08 +1000 Subject: Update scaladoc for Any.scala#equals() The transitive requirement for `Any` shouldn't mention `AnyRef` --- src/library-aux/scala/Any.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. -- cgit v1.2.3 From 6a4ca9bafe6b9f8dbfbcbb71fa86f2c34c53b753 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 13 Jul 2015 18:06:35 -0400 Subject: SI-8744 fix version.number in scaladoc.properties the fix is as suggested by Adriaan in the ticket --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 589e1931b8..f595e464f8 100755 --- a/build.xml +++ b/build.xml @@ -1196,7 +1196,7 @@ TODO: - + -- cgit v1.2.3 From 3819d0c20084997ad56432f3475fbe4adeb9d6d4 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Wed, 15 Jul 2015 10:59:16 +0100 Subject: Fix 23 typos (t-v) --- src/compiler/scala/tools/ant/Scalac.scala | 2 +- src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala | 2 +- src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala | 4 ++-- src/compiler/scala/tools/nsc/transform/LazyVals.scala | 2 +- src/compiler/scala/tools/nsc/transform/Mixin.scala | 4 ++-- src/compiler/scala/tools/nsc/transform/UnCurry.scala | 2 +- src/compiler/scala/tools/nsc/transform/patmat/MatchCodeGen.scala | 2 +- .../scala/tools/nsc/transform/patmat/MatchOptimization.scala | 6 +++--- src/compiler/scala/tools/nsc/typechecker/Infer.scala | 2 +- src/reflect/scala/reflect/internal/Symbols.scala | 2 +- src/reflect/scala/reflect/internal/tpe/TypeMaps.scala | 2 +- src/reflect/scala/reflect/internal/transform/Erasure.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/model/diagram/Diagram.scala | 2 +- test/files/neg/t7214neg.scala | 2 +- test/files/pos/t6089b.scala | 2 +- test/files/pos/t7689.scala | 2 +- test/files/run/t2127.scala | 2 +- test/files/run/t7214.scala | 2 +- 19 files changed, 23 insertions(+), 23 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 dec5adc9aa..daa31c5dfe 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala @@ -289,7 +289,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/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/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 b310e6c3a1..7a9dfda43e 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/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/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index ea0a9bb243..ab9fa26bac 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/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 285d59c5e2..01be52eac0 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -1153,7 +1153,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`. diff --git a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala index 15a87200f1..817c9706b4 100644 --- a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala +++ b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala @@ -736,7 +736,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 707972242a..01e28e5642 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/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 } diff --git a/test/files/neg/t7214neg.scala b/test/files/neg/t7214neg.scala index ff1ea8082d..e2b2d908d8 100644 --- a/test/files/neg/t7214neg.scala +++ b/test/files/neg/t7214neg.scala @@ -1,4 +1,4 @@ -// pattern matcher crashes here trying to synthesize an uneeded outer test. +// pattern matcher crashes here trying to synthesize an unneeded outer test. // no-symbol does not have an owner // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49) // at scala.tools.nsc.Global.abort(Global.scala:253) diff --git a/test/files/pos/t6089b.scala b/test/files/pos/t6089b.scala index ff7ca157eb..040987413e 100644 --- a/test/files/pos/t6089b.scala +++ b/test/files/pos/t6089b.scala @@ -1,5 +1,5 @@ // this crazy code simply tries to nest pattern matches so that the last call is in a tricky-to-determine -// tail position (my initial tightenign of tailpos detection for SI-6089 ruled this out) +// tail position (my initial tightening of tailpos detection for SI-6089 ruled this out) class BKTree { @annotation.tailrec final def -?-[AA](a: AA): Boolean = this match { diff --git a/test/files/pos/t7689.scala b/test/files/pos/t7689.scala index 022e7ab7a0..72cca99bc0 100644 --- a/test/files/pos/t7689.scala +++ b/test/files/pos/t7689.scala @@ -2,6 +2,6 @@ object A { // The default getter must have an explicit return type (List[_] => Int) // This wasn't happening since e28c3edda4. That commit encoded upper/lower // bounds of Any/Nothing as EmptyTree, which were triggering an .isEmpty - // check in Namers#TypeTreeSubstitutor + // check in Namers#TypeTreeSubstituter def x(f: List[_] => Int = _ => 3) = 9 } diff --git a/test/files/run/t2127.scala b/test/files/run/t2127.scala index 869d8a38d6..839c8d6a5c 100755 --- a/test/files/run/t2127.scala +++ b/test/files/run/t2127.scala @@ -28,5 +28,5 @@ } -The constructor invocation of Bar is done within the scope of object Foo's constructor, and therefor the private constructor of Foo should be visible and accessible. +The constructor invocation of Bar is done within the scope of object Foo's constructor, and therefore the private constructor of Foo should be visible and accessible. */ diff --git a/test/files/run/t7214.scala b/test/files/run/t7214.scala index 15c2c24fa0..b2ef53eeab 100644 --- a/test/files/run/t7214.scala +++ b/test/files/run/t7214.scala @@ -1,4 +1,4 @@ -// pattern matcher crashes here trying to synthesize an uneeded outer test. +// pattern matcher crashes here trying to synthesize an unneeded outer test. // no-symbol does not have an owner // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49) // at scala.tools.nsc.Global.abort(Global.scala:253) -- cgit v1.2.3 From 63a18ac35b70f01a7693f5b05f7176f22b38b3c1 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Wed, 15 Jul 2015 11:09:52 +0100 Subject: Improve some names (t-v) --- src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 4 ++-- test/files/run/test-cpp.scala | 2 +- test/junit/scala/tools/nsc/doc/html/HtmlDocletTest.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 4b30b4e436..36423fa2aa 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/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala index 4e00e72658..4fca67d51e 100644 --- a/test/files/run/test-cpp.scala +++ b/test/files/run/test-cpp.scala @@ -46,7 +46,7 @@ object TestSetterInline { * The access of the local variable 'y' should be replaced by the * constant. */ -object TestAliasChainConstat { +object TestAliasChainConstant { def main(args: Array[String]): Unit = { val x = 2 diff --git a/test/junit/scala/tools/nsc/doc/html/HtmlDocletTest.scala b/test/junit/scala/tools/nsc/doc/html/HtmlDocletTest.scala index 13a955b55d..d17856eb54 100644 --- a/test/junit/scala/tools/nsc/doc/html/HtmlDocletTest.scala +++ b/test/junit/scala/tools/nsc/doc/html/HtmlDocletTest.scala @@ -10,7 +10,7 @@ import scala.tools.testing.AssertUtil._ @RunWith(classOf[JUnit4]) class HtmlDocletTest { @Test - def testSyntaxHighlightningUnicode() { + def testSyntaxHighlightingUnicode() { val in = "unicode: …" val out = SyntaxHigh(in).toString -- cgit v1.2.3 From 5eb024570038c9b2e86dde5517d0108faf027f0b Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 15 Jul 2015 09:58:07 -0400 Subject: use newer Redcarpet to build spec now that https://github.com/vmg/redcarpet/issues/494 is fixed we don't need to stay pinned to an outdated version anymore --- Gemfile | 2 +- spec/README.md | 2 +- spec/_config.yml | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index b74696e550..c8c926dfde 100644 --- a/Gemfile +++ b/Gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "jekyll", "2.5.3" gem "rouge" # gem 's3_website' -gem "redcarpet", "3.2.3" +gem "redcarpet", "3.3.2" diff --git a/spec/README.md b/spec/README.md index 2f582dec5c..1a201fc97c 100644 --- a/spec/README.md +++ b/spec/README.md @@ -8,7 +8,7 @@ Third, we'd like to support different output formats. An html page per chapter w ## Editing -We use redcarpet 3.1 and jekyll 2 to generate the html. Essentially, this is what github pages use. +We use Jekyll 2 and [Redcarpet](https://github.com/vmg/redcarpet) to generate the html. Essentially, this is what github pages use. ## Building diff --git a/spec/_config.yml b/spec/_config.yml index 1052ddedb0..74ec602f8f 100644 --- a/spec/_config.yml +++ b/spec/_config.yml @@ -6,5 +6,3 @@ markdown: redcarpet encoding: utf-8 redcarpet: extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "tables", "with_toc_data", "strikethrough", "lax_spacing", "space_after_headers", "superscript", "footnotes"] -# with_toc_data requires redcarpet 3.1 to get -# pretty ID attributes for Hn headers (https://github.com/vmg/redcarpet/pull/186) -- cgit v1.2.3 From 3c15fda6ba51ae74078a1eb454c73caa42ee56c7 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 15 Jul 2015 10:03:24 -0400 Subject: opt-in to Travis's newer/faster container-based infrastructure this is the way Travis is headed, so let's get on board --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6a7ac45e3d..236e002a5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +# opt-in to Travis's newer/faster container-based infrastructure +sudo: false + # this builds the spec using jekyll # based on http://www.paperplanes.de/2013/8/13/deploying-your-jekyll-blog-to-s3-with-travis-ci.html language: ruby @@ -17,4 +20,4 @@ after_success: - openssl aes-256-cbc -pass "pass:$PRIV_KEY_SECRET" -in spec/id_dsa_travis.enc -out spec/id_dsa_travis -d -a - chmod 600 spec/id_dsa_travis - eval "$(ssh-agent)" - - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ssh-add -D && ssh-add spec/id_dsa_travis && rsync -e "ssh -o StrictHostKeyChecking=no" -rzv build/spec/ scalatest@chara.epfl.ch:/home/linuxsoft/archives/scala/spec/2.11/' \ No newline at end of file + - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ssh-add -D && ssh-add spec/id_dsa_travis && rsync -e "ssh -o StrictHostKeyChecking=no" -rzv build/spec/ scalatest@chara.epfl.ch:/home/linuxsoft/archives/scala/spec/2.11/' -- cgit v1.2.3 From 585cf5a2397210eb37cb01bf5a29771beef21412 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 16 Jul 2015 15:02:24 +1000 Subject: SI-9401 Avoid SOE with array + missing classtag The implicit classtags required by the Array constructor are not expressed in the type signature of its constructor, and instead are summoned by a special case in the typechecker. This special case entails replacing the `new Array` tree with `implicitly[T].newArray(size)`, handled in `ArrayInstantiation`. This tree is recursively typechecked. However, if the implicit materialization/search fails, an error is issued to the current reporter and the original tree is marked with an error type. As above, this is recursively typechecked. In the normal course of affairs, the recursive typecheck of the erroneous tree would be a noop (the tree already has a type!). However, if we are both in silent mode (in which errors are buffered) and in retyping mode (in which the typer clears the type and symbols of trees), we were getting into an cycle. In the enclosed test, retyping mode was trying to recover from: Resetting.this.gencastarray_=(new Array[T](0).) By inserting a suitable a view: implicitly[Resetting => { def gencastarray_=(AT)}]( Resetting.this ).gencastarray_=(new Array[T](0)) Where AT is the type found by retypechecking the argument. It is during the argument retypechecking that we fell into cycle. Crazily enough, in 2.11.0, the ensuing `StackOverflowError` was being caught and treated as a failure. We would then back out of the retyping mode, and issue the error from the the very first attempt at the implicit search. This fragile state of affairs was disrupted by a refactoring to the error reporting system in 725c5c9, after which the SOE crashed the compiler. This commit avoids recursively typechecking error typed trees. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 +- test/files/neg/t9401.check | 4 ++++ test/files/neg/t9401.scala | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/files/neg/t9401.check create mode 100644 test/files/neg/t9401.scala diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index b5129af9ec..fd1a6f293f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4577,7 +4577,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/test/files/neg/t9401.check b/test/files/neg/t9401.check new file mode 100644 index 0000000000..638d56db63 --- /dev/null +++ b/test/files/neg/t9401.check @@ -0,0 +1,4 @@ +t9401.scala:3: error: cannot find class tag for element type T + gencastarray = new Array[T](0) + ^ +one error found diff --git a/test/files/neg/t9401.scala b/test/files/neg/t9401.scala new file mode 100644 index 0000000000..f42ecc7f74 --- /dev/null +++ b/test/files/neg/t9401.scala @@ -0,0 +1,4 @@ +class Resetting[T] { + var gencastarray: Any = null + gencastarray = new Array[T](0) +} -- cgit v1.2.3 From f48393ea56fef71f53c7f5f959df5043ba65c144 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Fri, 17 Jul 2015 16:08:05 +0100 Subject: Fix 6 typos (w-z) --- src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala | 2 +- src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 2 +- .../scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index d2d510e8a9..c7c2e43f82 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 71686fd9d7..2f1cd732da 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -3031,7 +3031,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/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/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index a7ef5d5d2f..43f2655311 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 -- cgit v1.2.3 From 57d377955b97623c45fa7d08fe94df0cc0263c9f Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Fri, 17 Jul 2015 16:38:44 +0100 Subject: Fix typo in val name --- src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 11984da0d7..7ec9cd74a4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1361,7 +1361,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 @@ -1371,7 +1371,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) -- cgit v1.2.3 From 6d56b6512881a5385c95a8f2f881139118596f51 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 17 Jul 2015 19:59:21 -0400 Subject: SI-9406 fix doc for Range.takeRight --- src/library/scala/collection/immutable/Range.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 3ae8a2c342..79cd673932 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -285,7 +285,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 */ -- cgit v1.2.3 From ad50127460b9298731f8ced4f0998a3dbc2fe43b Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 18 Jul 2015 12:58:12 -0400 Subject: SI-9409 Scaladoc: remove link to nonexistent diagram doc --- src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala | 1 - 1 file changed, 1 deletion(-) 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 81036b4908..ea6caa138a 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala @@ -676,7 +676,6 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp if (diagramSvg != NodeSeq.Empty) {
{ description } - Learn more about scaladoc diagrams
{ diagramSvg }
-- cgit v1.2.3 From b6feac28697934e3c8ea7d90025cf6032062a886 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 20 Jul 2015 17:21:16 +0200 Subject: SI-8502 create PackageClass instead of Class symbol stubs for pkgs https://github.com/scala/scala/pull/4111 creates a stub type symbol for missing packages, deferring (or avoiding) a crash if a package is missing. The symbol created was a ClassSymbol, which could lead to an assertion failure in flattten: case TypeRef(pre, sym, args) if isFlattenablePrefix(pre) => assert(args.isEmpty && sym.enclosingTopLevelClass != NoSymbol, sym.ownerChain) `pre` is the stub ClassSymbol, so `isFlattenablePrefix` is true (but it should be false). The assertion then fails because the enclosing class of a top-level class defined in a missing package is NoSymbol. This failed only with GenBCode, which traverses more of the symbol graph while building ClassBTypes: it looks collects the nested classes of `Outer` into a `NestedInfo`. --- src/intellij/interactive.iml.SAMPLE | 1 + src/intellij/repl.iml.SAMPLE | 1 + src/intellij/scaladoc.iml.SAMPLE | 1 + src/reflect/scala/reflect/internal/Symbols.scala | 5 ++- .../reflect/internal/pickling/UnPickler.scala | 2 +- test/files/run/t8502b.scala | 46 ++++++++++++++++++++++ 6 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 test/files/run/t8502b.scala 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 @@ + \ 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 @@ + 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 @@ + \ No newline at end of file diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 285d59c5e2..395f759086 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -495,8 +495,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) } @@ -3469,6 +3469,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 1fc7aebab0..1f643b2b23 100644 --- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala +++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala @@ -398,7 +398,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/test/files/run/t8502b.scala b/test/files/run/t8502b.scala new file mode 100644 index 0000000000..4f70d13bb0 --- /dev/null +++ b/test/files/run/t8502b.scala @@ -0,0 +1,46 @@ +import scala.tools.partest._ +import java.io.File + +// used to crash with an assertion failure in flatten because the type symbol created for the missing +// package was a ClassSymbol, not a PackageClassSymbol +// - isFlattenablePrefix(vanishingPackage) was true (wrongly) +// - therefore flatten tried to flatten the class defined in the package, but the class is +// top-level, vanishingClass.enclosingTopLevelClass is NoSymbol +object Test extends StoreReporterDirectTest { + def code = ??? + + def compileCode(code: String) = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) + } + + def show(): Unit = { + compileCode(""" + class Outer { + class Nested extends vanishing.Vanishing + } + + package vanishing { + class Vanishing + } + """) + assert(filteredInfos.isEmpty, filteredInfos) + deletePackage("vanishing") + compileCode(""" + class Test { + def f(o: Outer): Outer = o + } + """) + assert(storeReporter.infos.isEmpty, storeReporter.infos.mkString("\n")) // Included a MissingRequirementError before. + } + + def deletePackage(name: String) { + val directory = new File(testOutput.path, name) + for (f <- directory.listFiles()) { + assert(f.getName.endsWith(".class")) + assert(f.delete()) + } + assert(directory.listFiles().isEmpty) + assert(directory.delete()) + } +} -- cgit v1.2.3