summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-07-13 10:42:58 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-07-13 10:42:58 -0700
commit216e09b3ead43039f2e34a135820ef098c3be74e (patch)
treec312a233cf3e2cf0c7ddcd679d1437a32dc819ae /src
parent9df8f8ae9e36cf1c04929b7b0d2bdfb6fd2f360f (diff)
parent18e3e61778918e4e802b8fb75789635409523372 (diff)
downloadscala-216e09b3ead43039f2e34a135820ef098c3be74e.tar.gz
scala-216e09b3ead43039f2e34a135820ef098c3be74e.tar.bz2
scala-216e09b3ead43039f2e34a135820ef098c3be74e.zip
Merge pull request #4622 from retronym/merge/2.11.x-to-2.12.x-20150713
Merge 2.11.x to 2.12.x [ci: last-only]
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/quasiquotes/Reifiers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Properties.scala8
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala5
-rw-r--r--src/compiler/scala/tools/nsc/reporters/Reporter.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala37
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala5
-rw-r--r--src/eclipse/partest/.classpath2
-rw-r--r--src/eclipse/repl/.classpath3
-rw-r--r--src/eclipse/scaladoc/.classpath6
-rw-r--r--src/eclipse/test-junit/.classpath2
-rw-r--r--src/library/scala/Predef.scala5
-rw-r--r--src/library/scala/collection/generic/MutableSortedSetFactory.scala2
-rw-r--r--src/library/scala/collection/immutable/StringOps.scala7
-rw-r--r--src/library/scala/sys/BooleanProp.scala1
-rw-r--r--src/library/scala/sys/Prop.scala4
-rw-r--r--src/manual/scala/tools/docutil/ManMaker.scala2
-rw-r--r--src/partest-extras/scala/tools/partest/ASMConverters.scala2
-rw-r--r--src/partest-extras/scala/tools/partest/ReplTest.scala34
-rw-r--r--src/reflect/scala/reflect/api/Internals.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala2
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala8
-rw-r--r--src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala2
-rw-r--r--src/reflect/scala/reflect/macros/FrontEnds.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/SymbolTable.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/SynchronizedTypes.scala4
-rw-r--r--src/repl-jline/scala/tools/nsc/interpreter/jline/FileBackedHistory.scala12
-rw-r--r--src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/Formatting.scala3
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ILoop.scala27
-rw-r--r--src/repl/scala/tools/nsc/interpreter/IMain.scala4
-rw-r--r--src/repl/scala/tools/nsc/interpreter/Pasted.scala8
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ReplProps.scala46
-rwxr-xr-xsrc/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/Entity.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala2
49 files changed, 178 insertions, 117 deletions
diff --git a/src/compiler/scala/reflect/quasiquotes/Reifiers.scala b/src/compiler/scala/reflect/quasiquotes/Reifiers.scala
index 8462debe21..b2002a07ea 100644
--- a/src/compiler/scala/reflect/quasiquotes/Reifiers.scala
+++ b/src/compiler/scala/reflect/quasiquotes/Reifiers.scala
@@ -317,7 +317,7 @@ trait Reifiers { self: Quasiquotes =>
* Reification of non-trivial list is done in two steps:
*
* 1. split the list into groups where every placeholder is always
- * put in a group of its own and all subsquent non-holeMap are
+ * put in a group of its own and all subsequent non-holeMap are
* grouped together; element is considered to be a placeholder if it's
* in the domain of the fill function;
*
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala
index ca7d8776d4..cb523edfe5 100644
--- a/src/compiler/scala/tools/nsc/Properties.scala
+++ b/src/compiler/scala/tools/nsc/Properties.scala
@@ -12,8 +12,16 @@ object Properties extends scala.util.PropertiesTrait {
protected def pickJarBasedOn = classOf[Global]
// settings based on jar properties, falling back to System prefixed by "scala."
+
+ // messages to display at startup or prompt, format string with string parameters
+ // Scala version, Java version, JVM name
def residentPromptString = scalaPropOrElse("resident.prompt", "\nnsc> ")
def shellPromptString = scalaPropOrElse("shell.prompt", "%nscala> ")
+ def shellWelcomeString = scalaPropOrElse("shell.welcome",
+ """Welcome to Scala %1$#s (%3$s, Java %2$s).
+ |Type in expressions for evaluation. Or try :help.""".stripMargin
+ )
+
// message to display at EOF (which by default ends with
// a newline so as not to break the user's terminal)
def shellInterruptedString = scalaPropOrElse("shell.interrupted", f":quit$lineSeparator")
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 0575b9703e..bf53c47e9a 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -233,7 +233,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
}
/** Return the synchronized part of the double-checked locking idiom around the syncBody tree. It guards with `cond` and
- * synchronizez on `clazz.this`. Additional statements can be included after initialization,
+ * synchronizes on `clazz.this`. Additional statements can be included after initialization,
* (outside the synchronized block).
*
* The idiom works only if the condition is using a volatile field.
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala
index 076f84ce7a..351a8e33d3 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala
@@ -86,7 +86,7 @@ trait Opcodes { self: ICodes =>
* Each case subclass will represent a specific operation.
*/
abstract class Instruction extends Cloneable {
- // Vlad: I used these for checking the quality of the implementation, and we should regularely run a build with them
+ // Vlad: I used these for checking the quality of the implementation, and we should regularly run a build with them
// enabled. But for production these should definitely be disabled, unless we enjoy getting angry emails from Greg :)
//if (!this.isInstanceOf[opcodes.LOAD_EXCEPTION])
// assert(consumed == consumedTypes.length)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
index 150f38d6ec..9bae63f1fc 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
@@ -648,7 +648,7 @@ abstract class BTypes {
* JVMS 4.7.7: the attribute must be present "if and only if it represents a local class
* or an anonymous class" (i.e. not for member classes).
*
- * The attribute is mis-named, it should be called "EnclosingClass". It has to be defined for all
+ * The attribute is misnamed, it should be called "EnclosingClass". It has to be defined for all
* local and anonymous classes, no matter if there is an enclosing method or not. Accordingly, the
* "class" field (see below) must be always defined, while the "method" field may be null.
*
@@ -798,7 +798,7 @@ abstract class BTypes {
* 2. The ClassBType should be built from a classfile, but the class could not be found on the
* compilation classpath.
*
- * Note that all ClassBTypes required in a non-optimzied run are built during code generation from
+ * Note that all ClassBTypes required in a non-optimized run are built during code generation from
* the class symbols referenced by the ASTs, so they have a valid info. Therefore the backend
* often invokes `info.get` (which asserts the info to exist) when reading data from the ClassBType.
*
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
index 5f8f0e167c..cf29c8090b 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
@@ -355,7 +355,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
// See comment in BTypes, when is a class marked static in the InnerClass table.
val isStaticNestedClass = isOriginallyStaticOwner(innerClassSym.originalOwner)
- // After lambdalift (which is where we are), the rawowoner field contains the enclosing class.
+ // After lambdalift (which is where we are), the rawowner field contains the enclosing class.
val enclosingClass = {
// (1) Example java source: class C { static class D { } }
// The Scala compiler creates a class and a module symbol for C. Because D is a static
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
index 16e8aee1dd..00b4b8b667 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
@@ -167,6 +167,11 @@ abstract class GenBCode extends BCodeSyncAndTry {
)
}
+ // shim for SBT, see https://github.com/sbt/sbt/issues/2076
+ // TODO put this closer to classfile writing once we have closure elimination
+ // TODO create a nicer public API to find out the correspondence between sourcefile and ultimate classfiles
+ currentUnit.icode += new icodes.IClass(cd.symbol)
+
// -------------- mirror class, if needed --------------
val mirrorC =
if (isTopLevelModuleClass(claszSymbol)) {
diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
index 3d688efae1..bd438f0e75 100644
--- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
@@ -20,7 +20,7 @@ abstract class Reporter extends scala.reflect.internal.Reporter {
/** Informational messages. If `!force`, they may be suppressed. */
final def info(pos: Position, msg: String, force: Boolean): Unit = info0(pos, msg, INFO, force)
- /** For sending a message which should not be labeled as a warning/error,
+ /** For sending a message which should not be labelled as a warning/error,
* but also shouldn't require -verbose to be visible.
*/
def echo(msg: String): Unit = info(NoPosition, msg, force = true)
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala
index 9e9372f709..8beb1837ad 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala
@@ -40,7 +40,7 @@ trait MatchWarnings {
}
}
- // Issue better warnings than "unreachable code" when people mis-use
+ // Issue better warnings than "unreachable code" when people misuse
// variable patterns thinking they bind to existing identifiers.
//
// Possible TODO: more deeply nested variable patterns, like
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index c80aaea160..b0bd9977a8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -550,23 +550,18 @@ trait ContextErrors {
def ModuleUsingCompanionClassDefaultArgsErrror(tree: Tree) =
NormalTypeError(tree, "module extending its companion class cannot use default constructor arguments")
- def NotEnoughArgsError(tree: Tree, fun0: Tree, missing0: List[Symbol]) = {
- def notEnoughArgumentsMsg(fun: Tree, missing: List[Symbol]) = {
- val suffix = {
- if (missing.isEmpty) ""
- else {
- val keep = missing take 3 map (_.name)
- ".\nUnspecified value parameter%s %s".format(
- if (missing.tail.isEmpty) "" else "s",
- if ((missing drop 3).nonEmpty) (keep :+ "...").mkString(", ")
- else keep.mkString("", ", ", ".")
- )
- }
+ def NotEnoughArgsError(tree: Tree, fun: Tree, missing: List[Symbol]) = {
+ val notEnoughArgumentsMsg = {
+ val suffix = if (missing.isEmpty) "" else {
+ val keep = missing take 3 map (_.name)
+ val ess = if (missing.tail.isEmpty) "" else "s"
+ f".%nUnspecified value parameter$ess ${
+ keep.mkString("", ", ", if ((missing drop 3).nonEmpty) "..." else ".")
+ }"
}
-
- "not enough arguments for " + treeSymTypeMsg(fun) + suffix
+ s"not enough arguments for ${ treeSymTypeMsg(fun) }$suffix"
}
- NormalTypeError(tree, notEnoughArgumentsMsg(fun0, missing0))
+ NormalTypeError(tree, notEnoughArgumentsMsg)
}
//doTypedApply - patternMode
@@ -632,12 +627,16 @@ trait ContextErrors {
//adapt
def MissingArgsForMethodTpeError(tree: Tree, meth: Symbol) = {
+ val f = meth.name
+ val paf = s"$f(${ meth.asMethod.paramLists map (_ map (_ => "_") mkString ",") mkString ")(" })"
+ val advice = s"""
+ |Unapplied methods are only converted to functions when a function type is expected.
+ |You can make this conversion explicit by writing `$f _` or `$paf` instead of `$f`.""".stripMargin
val message =
if (meth.isMacro) MacroTooFewArgumentListsMessage
- else "missing arguments for " + meth.fullLocationString + (
- if (meth.isConstructor) ""
- else ";\nfollow this method with `_' if you want to treat it as a partially applied function"
- )
+ else s"""missing argument list for ${meth.fullLocationString}${
+ if (!meth.isConstructor) advice else ""
+ }"""
issueNormalTypeError(tree, message)
setError(tree)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 7c931600e5..4c840818da 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -1495,7 +1495,7 @@ object ContextMode {
final val TypeConstructorAllowed: ContextMode = 1 << 16
/** TODO: The "sticky modes" are EXPRmode, PATTERNmode, TYPEmode.
- * To mimick the sticky mode behavior, when captain stickyfingers
+ * To mimic the sticky mode behavior, when captain stickyfingers
* comes around we need to propagate those modes but forget the other
* context modes which were once mode bits; those being so far the
* ones listed here.
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 3274c86072..7ce945dd6c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -846,7 +846,7 @@ trait Implicits {
errors.collectFirst { case err: DivergentImplicitTypeError => err } foreach saveDivergent
if (search.isDivergent && divergentError.isEmpty) {
- // Divergence triggered by `i` at this level of the implicit serach. We haven't
+ // Divergence triggered by `i` at this level of the implicit search. We haven't
// seen divergence so far, we won't issue this error just yet, and instead temporarily
// treat `i` as a failed candidate.
saveDivergent(DivergentImplicitTypeError(tree, pt, i.sym))
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index f90e32ce8a..f3856db552 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -436,7 +436,7 @@ trait MethodSynthesis {
if (tree.symbol.owner.isTrait || hasUnitType(basisSym)) rhs1
else gen.mkAssignAndReturn(basisSym, rhs1)
)
- derivedSym setPos tree.pos // cannot set it at createAndEnterSymbol because basisSym can possible stil have NoPosition
+ derivedSym setPos tree.pos // cannot set it at createAndEnterSymbol because basisSym can possibly still have NoPosition
val ddefRes = DefDef(derivedSym, new ChangeOwnerAndModuleClassTraverser(basisSym, derivedSym)(body))
// ValDef will have its position focused whereas DefDef will have original correct rangepos
// ideally positions would be correct at the creation time but lazy vals are really a special case
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 77c49a862a..c1655467e9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -204,7 +204,7 @@ trait Namers extends MethodSynthesis {
}
// FIXME - this logic needs to be thoroughly explained
- // and justified. I know it's wrong with repect to package
+ // and justified. I know it's wrong with respect to package
// objects, but I think it's also wrong in other ways.
protected def conflict(newS: Symbol, oldS: Symbol) = (
( !oldS.isSourceMethod
@@ -1106,7 +1106,7 @@ trait Namers extends MethodSynthesis {
* As a first side effect, this method assigns a MethodType constructed using this
* return type to `meth`. This allows omitting the result type for recursive methods.
*
- * As another side effect, this method also assigns paramter types from the overridden
+ * As another side effect, this method also assigns parameter types from the overridden
* method to parameters of `meth` that have missing types (the parser accepts missing
* parameter types under -Yinfer-argument-types).
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
index 8a66c7d274..a702b3cdf5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
@@ -305,7 +305,7 @@ trait PatternTypers {
// clearing the type is necessary so that ref will be stabilized; see bug 881
val fun1 = typedPos(fun.pos)(Apply(Select(fun.clearType(), unapplyMethod), unapplyArgTree :: Nil))
- def makeTypedUnApply() = {
+ def makeTypedUnapply() = {
// the union of the expected type and the inferred type of the argument to unapply
val glbType = glb(ensureFullyDefined(pt) :: unapplyArg.tpe_* :: Nil)
val wrapInTypeTest = canRemedy && !(fun1.symbol.owner isNonBottomSubClass ClassTagClass)
@@ -325,7 +325,7 @@ trait PatternTypers {
if (isBlackbox(unapplyMethod)) duplErrorTree(BlackboxExtractorExpansion(tree))
else duplErrorTree(WrongShapeExtractorExpansion(tree))
} else
- makeTypedUnApply()
+ makeTypedUnapply()
}
def wrapClassTagUnapply(uncheckedPattern: Tree, classTagExtractor: Tree, pt: Type): Tree = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
index 059981aa37..5f2643cb25 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
@@ -309,6 +309,7 @@ trait TypeDiagnostics {
// save the name because it will be mutated until it has been
// distinguished from the other types in the same error message
private val savedName = sym.name
+ private var postQualifiedWith: List[Symbol] = Nil
def restoreName() = sym.name = savedName
def modifyName(f: String => String) = sym setName newTypeName(f(sym.name.toString))
@@ -317,12 +318,12 @@ trait TypeDiagnostics {
*/
def qualifyDefaultNamespaces() = {
val intersect = Set(trueOwner, aliasOwner) intersect UnqualifiedOwners
- if (intersect.nonEmpty) preQualify()
+ if (intersect.nonEmpty && tp.typeSymbolDirect.name == tp.typeSymbol.name) preQualify()
}
// functions to manipulate the name
def preQualify() = modifyName(trueOwner.fullName + "." + _)
- def postQualify() = modifyName(_ + "(in " + trueOwner + ")")
+ def postQualify() = if (!(postQualifiedWith contains trueOwner)) { postQualifiedWith ::= trueOwner; modifyName(_ + "(in " + trueOwner + ")") }
def typeQualify() = if (sym.isTypeParameterOrSkolem) postQualify()
def nameQualify() = if (trueOwner.isPackageClass) preQualify() else postQualify()
diff --git a/src/eclipse/partest/.classpath b/src/eclipse/partest/.classpath
index 7e2f119193..de4acf8aa0 100644
--- a/src/eclipse/partest/.classpath
+++ b/src/eclipse/partest/.classpath
@@ -5,7 +5,7 @@
<classpathentry combineaccessrules="false" kind="src" path="/repl"/>
<classpathentry kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11/1.0.0/scala-partest_2.11-1.0.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.12.0-M1/1.0.7/scala-partest_2.12.0-M1-1.0.7.jar"/>
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
diff --git a/src/eclipse/repl/.classpath b/src/eclipse/repl/.classpath
index cbaabb9af1..14f7e16670 100644
--- a/src/eclipse/repl/.classpath
+++ b/src/eclipse/repl/.classpath
@@ -2,7 +2,8 @@
<classpath>
<classpathentry kind="src" path="repl"/>
<classpathentry combineaccessrules="false" kind="src" path="/asm"/>
- <classpathentry kind="var" path="M2_REPO/jline/jline/2.12/jline-2.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jline/jline/2.12.1/jline-2.12.1.jar"/>
+ <!-- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/repl/jline-2.12.jar"/> -->
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
diff --git a/src/eclipse/scaladoc/.classpath b/src/eclipse/scaladoc/.classpath
index ee6427176a..2b8282cfb3 100644
--- a/src/eclipse/scaladoc/.classpath
+++ b/src/eclipse/scaladoc/.classpath
@@ -6,8 +6,8 @@
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
<classpathentry combineaccessrules="false" kind="src" path="/partest-extras"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-xml_2.11/1.0.2/scala-xml_2.11-1.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.1/scala-parser-combinators_2.11-1.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11/1.0.0/scala-partest_2.11-1.0.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-xml_2.12.0-M1/1.0.4/scala-xml_2.12.0-M1-1.0.4"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-parser-combinators_2.12.0-M1/1.0.4/scala-parser-combinators_2.12.0-M1-1.0.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.12.0-M1/1.0.7/scala-partest_2.12.0-M1-1.0.7.jar"/>
<classpathentry kind="output" path="build-quick-scaladoc"/>
</classpath>
diff --git a/src/eclipse/test-junit/.classpath b/src/eclipse/test-junit/.classpath
index 8a599bd8c7..710d33b030 100644
--- a/src/eclipse/test-junit/.classpath
+++ b/src/eclipse/test-junit/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="test-junit"/>
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.10/junit-4.10.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/reflect"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 012e7afd74..281e056330 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -82,6 +82,11 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef {
*/
def classOf[T]: Class[T] = null // This is a stub method. The actual implementation is filled in by the compiler.
+ /** The `String` type in Scala has methods that come either from the underlying
+ * Java String (see the documentation corresponding to your Java version, for
+ * example [[http://docs.oracle.com/javase/8/docs/api/java/lang/String.html]]) or
+ * are added implicitly through [[scala.collection.immutable.StringOps]].
+ */
type String = java.lang.String
type Class[T] = java.lang.Class[T]
diff --git a/src/library/scala/collection/generic/MutableSortedSetFactory.scala b/src/library/scala/collection/generic/MutableSortedSetFactory.scala
index 0339a523e9..9bb12c2317 100644
--- a/src/library/scala/collection/generic/MutableSortedSetFactory.scala
+++ b/src/library/scala/collection/generic/MutableSortedSetFactory.scala
@@ -24,7 +24,7 @@ abstract class MutableSortedSetFactory[CC[A] <: mutable.SortedSet[A] with Sorted
/**
* mutable.SetBuilder uses '+' which is not a primitive for anything extending mutable.SetLike,
- * this causes serious perfomances issues since each time 'elems = elems + x'
+ * this causes serious performance issues since each time 'elems = elems + x'
* is evaluated elems is cloned (which is O(n)).
*
* Fortunately GrowingBuilder comes to rescue.
diff --git a/src/library/scala/collection/immutable/StringOps.scala b/src/library/scala/collection/immutable/StringOps.scala
index 6737692fb1..77333badf9 100644
--- a/src/library/scala/collection/immutable/StringOps.scala
+++ b/src/library/scala/collection/immutable/StringOps.scala
@@ -12,10 +12,9 @@ package immutable
import mutable.StringBuilder
-/**
- * This class serves as a wrapper providing `String`s with all the operations
- * found in indexed sequences. Where needed, instances of `String` object
- * are implicitly converted into this class.
+/** This class serves as a wrapper providing [[scala.Predef.String]]s with all
+ * the operations found in indexed sequences. Where needed, `String`s are
+ * implicitly converted into instances of this class.
*
* The difference between this class and `WrappedString` is that calling transformer
* methods such as `filter` and `map` will yield a `String` object, whereas a
diff --git a/src/library/scala/sys/BooleanProp.scala b/src/library/scala/sys/BooleanProp.scala
index e5e4668edb..b0008b41fd 100644
--- a/src/library/scala/sys/BooleanProp.scala
+++ b/src/library/scala/sys/BooleanProp.scala
@@ -50,6 +50,7 @@ object BooleanProp {
def get: String = "" + value
val clear, enable, disable, toggle = ()
def option = if (isSet) Some(value) else None
+ //def or[T1 >: Boolean](alt: => T1): T1 = if (value) true else alt
protected def zero = false
}
diff --git a/src/library/scala/sys/Prop.scala b/src/library/scala/sys/Prop.scala
index 17ae8cb69c..52a3d89ecb 100644
--- a/src/library/scala/sys/Prop.scala
+++ b/src/library/scala/sys/Prop.scala
@@ -58,6 +58,10 @@ trait Prop[+T] {
*/
def option: Option[T]
+ // Do not open until 2.12.
+ //** This value if the property is set, an alternative value otherwise. */
+ //def or[T1 >: T](alt: => T1): T1
+
/** Removes the property from the underlying map.
*/
def clear(): Unit
diff --git a/src/manual/scala/tools/docutil/ManMaker.scala b/src/manual/scala/tools/docutil/ManMaker.scala
index 47b861a80f..802b357f5f 100644
--- a/src/manual/scala/tools/docutil/ManMaker.scala
+++ b/src/manual/scala/tools/docutil/ManMaker.scala
@@ -18,7 +18,7 @@ class ManMaker extends Task {
/** The directory to put html pages in */
private var htmlout: Option[File] = None
- /** The directory to put man pags in */
+ /** The directory to put man pages in */
private var manout: Option[File] = None
diff --git a/src/partest-extras/scala/tools/partest/ASMConverters.scala b/src/partest-extras/scala/tools/partest/ASMConverters.scala
index e8d327d352..b4c686473b 100644
--- a/src/partest-extras/scala/tools/partest/ASMConverters.scala
+++ b/src/partest-extras/scala/tools/partest/ASMConverters.scala
@@ -142,7 +142,7 @@ object ASMConverters {
import collection.mutable.{Map => MMap}
/**
- * Bytecode is equal modula local variable numbering and label numbering.
+ * Bytecode is equal modulo local variable numbering and label numbering.
*/
def equivalentBytecode(as: List[Instruction], bs: List[Instruction], varMap: MMap[Int, Int] = MMap(), labelMap: MMap[Int, Int] = MMap()): Boolean = {
def same(v1: Int, v2: Int, m: MMap[Int, Int]) = {
diff --git a/src/partest-extras/scala/tools/partest/ReplTest.scala b/src/partest-extras/scala/tools/partest/ReplTest.scala
index 1fde2370d3..20dfe0eb16 100644
--- a/src/partest-extras/scala/tools/partest/ReplTest.scala
+++ b/src/partest-extras/scala/tools/partest/ReplTest.scala
@@ -6,8 +6,9 @@
package scala.tools.partest
import scala.tools.nsc.Settings
-import scala.tools.nsc.interpreter.ILoop
+import scala.tools.nsc.interpreter.{ ILoop, replProps }
import java.lang.reflect.{ Method => JMethod, Field => JField }
+import scala.util.matching.Regex
import scala.util.matching.Regex.Match
/** A class for testing repl code.
@@ -19,30 +20,33 @@ abstract class ReplTest extends DirectTest {
// final because we need to enforce the existence of a couple settings.
final override def settings: Settings = {
val s = super.settings
- // s.Yreplsync.value = true
s.Xnojline.value = true
transformSettings(s)
}
+ def normalize(s: String) = s
/** True for SessionTest to preserve session text. */
def inSession: Boolean = false
- /** True to preserve welcome text. */
+ /** True to preserve welcome header, eliding version number. */
def welcoming: Boolean = false
- lazy val welcome = "(Welcome to Scala) version .*".r
- def normalize(s: String) = s match {
- case welcome(w) => w
- case s => s
- }
- def unwelcoming(s: String) = s match {
- case welcome(w) => false
- case _ => true
- }
+ lazy val header = replProps.welcome
def eval() = {
val s = settings
log("eval(): settings = " + s)
- //ILoop.runForTranscript(code, s).lines drop 1 // not always first line
val lines = ILoop.runForTranscript(code, s, inSession = inSession).lines
- if (welcoming) lines map normalize
- else lines filter unwelcoming
+ (if (welcoming) {
+ val welcome = "(Welcome to Scala).*".r
+ //val welcome = Regex.quote(header.lines.next).r
+ //val version = "(.*version).*".r // version on separate line?
+ //var inHead = false
+ lines map {
+ //case s @ welcome() => inHead = true ; s
+ //case version(s) if inHead => inHead = false ; s
+ case welcome(s) => s
+ case s => s
+ }
+ } else {
+ lines drop header.lines.size
+ }) map normalize
}
def show() = eval() foreach println
}
diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala
index 577cd09295..1457fdc133 100644
--- a/src/reflect/scala/reflect/api/Internals.scala
+++ b/src/reflect/scala/reflect/api/Internals.scala
@@ -114,7 +114,7 @@ trait Internals { self: Universe =>
def substituteTypes(tree: Tree, from: List[Symbol], to: List[Type]): Tree
/** Substitute given tree `to` for occurrences of nodes that represent
- * `C.this`, where `C` referes to the given class `clazz`.
+ * `C.this`, where `C` refers to the given class `clazz`.
*/
def substituteThis(tree: Tree, clazz: Symbol, to: Tree): Tree
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index 3647d516a8..3552eb1713 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -103,7 +103,7 @@ trait Definitions extends api.StandardDefinitions {
def isNumericValueClass(sym: Symbol) = ScalaNumericValueClasses contains sym
def isGetClass(sym: Symbol) = (
- sym.name == nme.getClass_ // this condition is for performance only, this is called from `Typer#stabliize`.
+ sym.name == nme.getClass_ // this condition is for performance only, this is called from `Typer#stabilize`.
&& getClassMethods(sym)
)
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index 26e3cf6d0b..f1016e1b76 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -871,7 +871,7 @@ trait StdNames {
val toFloat: NameType = "toFloat"
val toDouble: NameType = "toDouble"
- // primitive operation methods for structual types mostly
+ // primitive operation methods for structural types mostly
// overlap with the above, but not for these two.
val toCharacter: NameType = "toCharacter"
val toInteger: NameType = "toInteger"
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 6ded3bcbe3..9c681f3423 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -925,7 +925,7 @@ trait Types
def prefixString = trimPrefix(toString) + "#"
/** Convert toString avoiding infinite recursions by cutting off
- * after `maxTostringRecursions` recursion levels. Uses `safeToString`
+ * after `maxToStringRecursions` recursion levels. Uses `safeToString`
* to produce a string on each level.
*/
override final def toString: String = {
@@ -1496,7 +1496,7 @@ trait Types
} finally {
if (Statistics.canEnable) Statistics.popTimer(typeOpsStack, start)
}
- // [Martin] suppressing memo-ization solves the problem with "same type after erasure" errors
+ // [Martin] suppressing memoization solves the problem with "same type after erasure" errors
// when compiling with
// scalac scala.collection.IterableViewLike.scala scala.collection.IterableLike.scala
// I have not yet figured out precisely why this is the case.
@@ -2602,7 +2602,7 @@ trait Types
* based on the bounds of the type parameters of the quantified type
* In Scala syntax, given a java-defined class C[T <: String], the existential type C[_]
* is improved to C[_ <: String] before skolemization, which captures (get it?) what Java does:
- * enter the type paramers' bounds into the context when checking subtyping/type equality of existential types
+ * enter the type parameters' bounds into the context when checking subtyping/type equality of existential types
*
* Also tried doing this once during class file parsing or when creating the existential type,
* but that causes cyclic errors because it happens too early.
@@ -4277,7 +4277,7 @@ trait Types
matchesType(res1, res2.substSym(tparams2, tparams1), alwaysMatchSimple)
(tp1, tp2) match {
case (MethodType(params1, res1), MethodType(params2, res2)) =>
- params1.length == params2.length && // useful pre-secreening optimization
+ params1.length == params2.length && // useful pre-screening optimization
matchingParams(params1, params2, tp1.isInstanceOf[JavaMethodType], tp2.isInstanceOf[JavaMethodType]) &&
matchesType(res1, res2, alwaysMatchSimple) &&
tp1.isImplicit == tp2.isImplicit
diff --git a/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala b/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala
index f79099213a..e321a07f51 100644
--- a/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala
+++ b/src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala
@@ -99,7 +99,7 @@ private[internal] trait TypeConstraints {
// a lower bound despite the fact that Nothing is always a lower bound. My current
// supposition is that the side-effecting type constraint accumulation mechanism
// depends on these subtype tests being performed to make forward progress when
- // there are mutally recursive type vars.
+ // there are mutually recursive type vars.
// See pos/t6367 and pos/t6499 for the competing test cases.
val mustConsider = tp.typeSymbol match {
case NothingClass => true
diff --git a/src/reflect/scala/reflect/macros/FrontEnds.scala b/src/reflect/scala/reflect/macros/FrontEnds.scala
index a770f325b2..8ad41382a8 100644
--- a/src/reflect/scala/reflect/macros/FrontEnds.scala
+++ b/src/reflect/scala/reflect/macros/FrontEnds.scala
@@ -12,7 +12,7 @@ package macros
trait FrontEnds {
self: blackbox.Context =>
- /** For sending a message which should not be labeled as a warning/error,
+ /** For sending a message which should not be labelled as a warning/error,
* but also shouldn't require -verbose to be visible.
* Use `enclosingPosition` if you're in doubt what position to pass to `pos`.
*/
diff --git a/src/reflect/scala/reflect/runtime/SymbolTable.scala b/src/reflect/scala/reflect/runtime/SymbolTable.scala
index 092bbd711f..eee2118898 100644
--- a/src/reflect/scala/reflect/runtime/SymbolTable.scala
+++ b/src/reflect/scala/reflect/runtime/SymbolTable.scala
@@ -3,7 +3,7 @@ package reflect
package runtime
/**
- * This symbol table trait fills in the definitions so that class information is obtained by refection.
+ * This symbol table trait fills in the definitions so that class information is obtained by reflection.
* It can be used either from a reflexive universe (class scala.reflect.runtime.JavaUniverse), or else from
* a runtime compiler that uses reflection to get a class information (class scala.tools.reflect.ReflectGlobal)
*/
diff --git a/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala b/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala
index 9bcf85dd6f..1d02cc7e89 100644
--- a/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala
+++ b/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala
@@ -82,9 +82,9 @@ private[reflect] trait SynchronizedTypes extends internal.Types { self: SymbolTa
override def toStringSubjects = _toStringSubjects.get
/* The idea of caches is as follows.
- * When in reflexive mode, a cache is either null, or one sentinal
+ * When in reflexive mode, a cache is either null, or one sentinel
* value representing undefined or the final defined
- * value. Hence, we can ask in non-synchronized ode whether the cache field
+ * value. Hence, we can ask in non-synchronized mode whether the cache field
* is non null and different from the sentinel (if a sentinel exists).
* If that's true, the cache value is current.
* Otherwise we arrive in one of the defined... methods listed below
diff --git a/src/repl-jline/scala/tools/nsc/interpreter/jline/FileBackedHistory.scala b/src/repl-jline/scala/tools/nsc/interpreter/jline/FileBackedHistory.scala
index b6c9792ec0..53a06ca972 100644
--- a/src/repl-jline/scala/tools/nsc/interpreter/jline/FileBackedHistory.scala
+++ b/src/repl-jline/scala/tools/nsc/interpreter/jline/FileBackedHistory.scala
@@ -7,9 +7,9 @@ package scala.tools.nsc.interpreter.jline
import _root_.jline.console.history.PersistentHistory
-
import scala.tools.nsc.interpreter
-import scala.tools.nsc.io.{File, Path}
+import scala.reflect.io.{ File, Path }
+import scala.tools.nsc.Properties.{ propOrNone, userHome }
/** TODO: file locking.
*/
@@ -85,9 +85,9 @@ object FileBackedHistory {
// val ContinuationChar = '\003'
// val ContinuationNL: String = Array('\003', '\n').mkString
- import scala.tools.nsc.Properties.userHome
-
- def defaultFileName = ".scala_history"
+ final val defaultFileName = ".scala_history"
- def defaultFile: File = File(Path(userHome) / defaultFileName)
+ def defaultFile: File = File(
+ propOrNone("scala.shell.histfile") map (Path.apply) getOrElse (Path(userHome) / defaultFileName)
+ )
}
diff --git a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala
index 1f6a1f7022..3bc259252a 100644
--- a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala
+++ b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala
@@ -15,7 +15,7 @@ import scala.tools.nsc.interpreter
import scala.tools.nsc.interpreter.session.{History, SimpleHistory}
-/** A straight scalification of the jline interface which mixes
+/** A straight scalafication of the jline interface which mixes
* in the sparse jline-independent one too.
*/
trait JLineHistory extends JHistory with History {
diff --git a/src/repl/scala/tools/nsc/interpreter/Formatting.scala b/src/repl/scala/tools/nsc/interpreter/Formatting.scala
index 844997429c..4a9548730a 100644
--- a/src/repl/scala/tools/nsc/interpreter/Formatting.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Formatting.scala
@@ -30,3 +30,6 @@ class Formatting(indent: Int) {
}
)
}
+object Formatting {
+ def forPrompt(prompt: String) = new Formatting(prompt.lines.toList.last.length)
+}
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
index e8c6d02d1e..612bdd98c9 100644
--- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
@@ -56,13 +56,9 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
private var globalFuture: Future[Boolean] = _
- /** Print a welcome message */
- def printWelcome() {
- echo(s"""
- |Welcome to Scala $versionString ($javaVmName, Java $javaVersion).
- |Type in expressions to have them evaluated.
- |Type :help for more information.""".trim.stripMargin
- )
+ /** Print a welcome message! */
+ def printWelcome(): Unit = {
+ Option(replProps.welcome) filter (!_.isEmpty) foreach echo
replinfo("[info] started at " + new java.util.Date)
}
@@ -111,10 +107,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
}
class ILoopInterpreter extends IMain(settings, out) {
- // the expanded prompt but without color escapes and without leading newline, for purposes of indenting
- override lazy val formatting: Formatting = new Formatting(
- (replProps.promptString format Properties.versionNumberString).lines.toList.last.length
- )
override protected def parentClassLoader =
settings.explicitParentLoader.getOrElse( classOf[ILoop].getClassLoader )
}
@@ -679,9 +671,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
}
def verbosity() = {
- val old = intp.printResults
- intp.printResults = !old
- echo("Switched " + (if (old) "off" else "on") + " result printing.")
+ intp.printResults = !intp.printResults
+ replinfo(s"Result printing is ${ if (intp.printResults) "on" else "off" }.")
}
/** Run one command submitted by the user. Two values are returned:
@@ -761,7 +752,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
private object paste extends Pasted {
import scala.util.matching.Regex.quote
- val ContinueString = " | "
+ val ContinuePrompt = replProps.continuePrompt
+ val ContinueString = replProps.continueText // " | "
val PromptString = prompt.lines.toList.last
val anyPrompt = s"""\\s*(?:${quote(PromptString.trim)}|${quote(AltPromptString.trim)})\\s*""".r
@@ -805,7 +797,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
echo("You typed two blank lines. Starting a new command.")
None
case IR.Incomplete =>
- in.readLine(paste.ContinueString) match {
+ in.readLine(paste.ContinuePrompt) match {
case null =>
// we know compilation is going to fail since we're at EOF and the
// parser thinks the input is still incomplete, but since this is
@@ -948,8 +940,9 @@ object ILoop {
Console.withOut(ostream) {
val output = new JPrintWriter(new OutputStreamWriter(ostream), true) {
// skip margin prefix for continuation lines, unless preserving session text for test
+ // should test for repl.paste.ContinueString or replProps.continueText.contains(ch)
override def write(str: String) =
- if (!inSession && (str forall (ch => ch.isWhitespace || ch == '|'))) () // repl.paste.ContinueString
+ if (!inSession && (str forall (ch => ch.isWhitespace || ch == '|'))) ()
else super.write(str)
}
val input = new BufferedReader(new StringReader(code.trim + "\n")) {
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala
index 2550a5dc57..841b4abfa5 100644
--- a/src/repl/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala
@@ -113,9 +113,7 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
def this() = this(new Settings())
// the expanded prompt but without color escapes and without leading newline, for purposes of indenting
- lazy val formatting: Formatting = new Formatting(
- (replProps.promptString format Properties.versionNumberString).lines.toList.last.length
- )
+ lazy val formatting = Formatting.forPrompt(replProps.promptText)
lazy val reporter: ReplReporter = new ReplReporter(this)
import formatting.indentCode
diff --git a/src/repl/scala/tools/nsc/interpreter/Pasted.scala b/src/repl/scala/tools/nsc/interpreter/Pasted.scala
index 5f388eb15b..f8d8c2ddb1 100644
--- a/src/repl/scala/tools/nsc/interpreter/Pasted.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Pasted.scala
@@ -21,7 +21,13 @@ abstract class Pasted {
def PromptString: String
def AltPromptString: String = "scala> "
- private val testBoth = PromptString != AltPromptString
+ /* `testBoth` cannot be a val, as `Pasted` is inherited by `object paste` in ILoop,
+ which would cause `val testBoth` to be initialized before `val PromptString` was.
+
+ object paste extends Pasted {
+ val PromptString = prompt.lines.toList.last
+ */
+ private def testBoth = PromptString != AltPromptString
private val spacey = " \t".toSet
def matchesPrompt(line: String) = matchesString(line, PromptString) || testBoth && matchesString(line, AltPromptString)
diff --git a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala
index df65e9974d..588d92f81b 100644
--- a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala
@@ -6,9 +6,11 @@
package scala.tools.nsc
package interpreter
-import Properties.shellPromptString
+import Properties.{ javaVersion, javaVmName, shellPromptString, shellWelcomeString,
+ versionString, versionNumberString }
import scala.sys._
import Prop._
+import java.util.{ Formattable, FormattableFlags, Formatter }
class ReplProps {
private def bool(name: String) = BooleanProp.keyExists(name)
@@ -22,12 +24,44 @@ class ReplProps {
val trace = bool("scala.repl.trace")
val power = bool("scala.repl.power")
- // Handy system prop for shell prompt, or else pick it up from compiler.properties
- val promptString = Prop[String]("scala.repl.prompt").option getOrElse (if (info) "%nscala %s> " else shellPromptString)
- val prompt = {
+ def enversion(s: String) = {
+ import FormattableFlags._
+ val v = new Formattable {
+ override def formatTo(formatter: Formatter, flags: Int, width: Int, precision: Int) = {
+ val version = if ((flags & ALTERNATE) != 0) versionNumberString else versionString
+ val left = if ((flags & LEFT_JUSTIFY) != 0) "-" else ""
+ val w = if (width >= 0) s"$width" else ""
+ val p = if (precision >= 0) s".$precision" else ""
+ val fmt = s"%${left}${w}${p}s"
+ formatter.format(fmt, version)
+ }
+ }
+ s.format(v, javaVersion, javaVmName)
+ }
+ def encolor(s: String) = {
import scala.io.AnsiColor.{ MAGENTA, RESET }
- val p = promptString format Properties.versionNumberString
- if (colorOk) s"$MAGENTA$p$RESET" else p
+ if (colorOk) s"$MAGENTA$s$RESET" else s
+ }
+
+ // Handy system prop for shell prompt, or else pick it up from compiler.properties
+ val promptString = Prop[String]("scala.repl.prompt").option getOrElse (if (info) "%nscala %#s> " else shellPromptString)
+ val promptText = enversion(promptString)
+ val prompt = encolor(promptText)
+
+ // Prompt for continued input, will be right-adjusted to width of the primary prompt
+ val continueString = Prop[String]("scala.repl.continue").option getOrElse "| "
+ val continueText = {
+ val text = enversion(continueString)
+ val margin = promptText.lines.toList.last.length - text.length
+ if (margin > 0) " " * margin + text else text
+ }
+ val continuePrompt = encolor(continueText)
+
+ // Next time.
+ //def welcome = enversion(Prop[String]("scala.repl.welcome") or shellWelcomeString)
+ def welcome = enversion {
+ val p = Prop[String]("scala.repl.welcome")
+ if (p.isSet) p.get else shellWelcomeString
}
/** CSV of paged,across to enable pagination or `-x` style
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
index f853df0484..9de6ec4ab9 100755
--- a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
@@ -114,7 +114,7 @@ trait MemberLookupBase {
// Maintaining compatibility with previous links is a bit tricky here:
// we have a preference for term names for all terms except for the last, where we prefer a class:
// How to do this:
- // - at each step we do a DFS search with the prefered strategy
+ // - at each step we do a DFS search with the preferred strategy
// - if the search doesn't return any members, we backtrack on the last decision
// * we look for terms with the last member's name
// * we look for types with the same name, all the way up
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala b/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala
index a3d05ae50b..e5eb68d65a 100644
--- a/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/comment/Comment.scala
@@ -93,7 +93,7 @@ abstract class Comment {
def todo: List[Body]
/** Whether the entity is deprecated. Using the `@deprecated` Scala attribute
- * is prefereable to using this Scaladoc tag. */
+ * is preferable to using this Scaladoc tag. */
def deprecated: Option[Body]
/** An additional note concerning the contract of the entity. */
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala
index ab8e9e2756..12c609af49 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramStats.scala
@@ -36,7 +36,7 @@ object DiagramStats {
private[this] val filterTrack = new TimeTracker("diagrams model filtering")
private[this] val modelTrack = new TimeTracker("diagrams model generation")
private[this] val dotGenTrack = new TimeTracker("dot diagram generation")
- private[this] val dotRunTrack = new TimeTracker("dot process runnning")
+ private[this] val dotRunTrack = new TimeTracker("dot process running")
private[this] val svgTrack = new TimeTracker("svg processing")
private[this] var brokenImages = 0
private[this] var fixedImages = 0
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
index 90de51d763..d55c51b19c 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
@@ -183,7 +183,7 @@ trait MemberEntity extends Entity {
/** Indicates whether the member is inherited by implicit conversion */
def isImplicitlyInherited: Boolean
- /** Indicates whether there is another member with the same name in the template that will take precendence */
+ /** Indicates whether there is another member with the same name in the template that will take precedence */
def isShadowedImplicit: Boolean
/** Indicates whether there are other implicitly inherited members that have similar signatures (and thus they all
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
index 178af3d4ba..3432e5e150 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -478,7 +478,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
override lazy val comment = {
def nonRootTemplate(sym: Symbol): Option[DocTemplateImpl] =
if (sym eq RootPackage) None else findTemplateMaybe(sym)
- /* Variable precendence order for implicitly added members: Take the variable definitions from ...
+ /* Variable precedence order for implicitly added members: Take the variable definitions from ...
* 1. the target of the implicit conversion
* 2. the definition template (owner)
* 3. the current template
@@ -994,7 +994,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
// pruning modules that shouldn't be documented
// Why Symbol.isInitialized? Well, because we need to avoid exploring all the space available to scaladoc
// from the classpath -- scaladoc is a hog, it will explore everything starting from the root package unless we
- // somehow prune the tree. And isInitialized is a good heuristic for prunning -- if the package was not explored
+ // somehow prune the tree. And isInitialized is a good heuristic for pruning -- if the package was not explored
// during typer and refchecks, it's not necessary for the current application and there's no need to explore it.
(!sym.isModule || sym.moduleClass.isInitialized) &&
// documenting only public and protected members
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala
index ea72fa6095..45745b5f55 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala
@@ -112,7 +112,7 @@ trait ModelFactoryTypeSupport {
def needsPrefix: Boolean = {
if ((owner != bSym.owner || preSym.isRefinementClass) && (normalizeTemplate(owner) != inTpl.sym))
return true
- // don't get tricked into prefixng method type params and existentials:
+ // don't get tricked into prefixing method type params and existentials:
// I tried several tricks BUT adding the method for which I'm creating the type => that simply won't scale,
// as ValueParams are independent of their parent member, and I really don't want to add this information to
// all terms, as we're already over the allowed memory footprint