summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md4
-rw-r--r--README.md76
-rw-r--r--docs/TODO2
-rw-r--r--spec/01-lexical-syntax.md2
-rw-r--r--spec/06-expressions.md2
-rw-r--r--spec/07-implicits.md2
-rw-r--r--spec/12-the-scala-standard-library.md6
-rw-r--r--spec/15-changelog.md4
-rw-r--r--src/actors/scala/actors/Future.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala10
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
-rw-r--r--src/compiler/scala/tools/reflect/ReflectGlobal.scala16
-rw-r--r--src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java2
-rw-r--r--src/library/scala/Equals.scala5
-rw-r--r--src/library/scala/collection/immutable/HashSet.scala1
-rw-r--r--src/library/scala/collection/immutable/ListSet.scala2
-rw-r--r--src/library/scala/collection/immutable/MapLike.scala5
-rw-r--r--src/library/scala/collection/immutable/Set.scala34
-rw-r--r--src/library/scala/collection/immutable/SortedMap.scala6
-rw-r--r--src/library/scala/util/Sorting.scala2
-rw-r--r--src/reflect/scala/reflect/api/Types.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Kinds.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/IMain.scala6
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala2
-rw-r--r--test/files/neg/name-lookup-stable.check2
-rw-r--r--test/files/neg/name-lookup-stable.scala2
-rw-r--r--test/files/neg/t5376.scala2
-rw-r--r--test/files/neg/t8597b.scala2
-rw-r--r--test/files/neg/t8675b.scala2
-rw-r--r--test/files/neg/virtpatmat_exhaust_compound.scala2
-rw-r--r--test/files/pos/t2405.scala4
-rw-r--r--test/files/pos/t8002-nested-scope.scala2
-rw-r--r--test/files/run/dead-code-elimination.scala2
-rw-r--r--test/files/run/names-defaults.scala2
-rw-r--r--test/files/run/nothingTypeNoOpt.scala2
-rw-r--r--test/files/run/repl-power.check3
-rw-r--r--test/files/run/repl-power.scala5
-rw-r--r--test/files/run/t8047.scala2
-rw-r--r--test/files/run/toolbox_expand_macro.check1
-rw-r--r--test/files/run/toolbox_expand_macro.scala23
-rw-r--r--test/junit/scala/collection/immutable/SetTests.scala81
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala2
-rw-r--r--versions.properties2
55 files changed, 280 insertions, 99 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e6557d78dd..d01a71b9bd 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -86,7 +86,7 @@ A pull request should consist of commits with messages that clearly state what p
Commit logs should be stated in the active, present tense.
-A commit's subject should be 60 characters or less. Overall, think of
+A commit's subject should be 72 characters or less. Overall, think of
the first line of the commit as a description of the action performed
by the commit on the code base, so use the active voice and the
present tense. That also makes the commit subjects easy to reuse in
@@ -113,7 +113,7 @@ Our pull request bot, Scabot, automatically builds all the commits in a PR indiv
Click on the little x next to a commit sha to go to the overview of the PR validation job. To diagnose a failure, consult the console output of the job that failed.
-See the [scala-jenkins-infra repo](https://github.com/scala/scala-jenkins-infra) and [Scabot repo](https://github.com/) for full details on PR validation. One tip you should know is that commenting `/rebuild` on a PR asks validation to be run again on the same commits. This is only necessary when a spurious failure occurred.
+See the [scala-jenkins-infra repo](https://github.com/scala/scala-jenkins-infra) and [Scabot repo](https://github.com/scala/scabot) for full details on PR validation. One tip you should know is that commenting `/rebuild` on a PR asks validation to be run again on the same commits. This is only necessary when a spurious failure occurred.
### Pass code review
diff --git a/README.md b/README.md
index 60952a545b..7b7c91b7de 100644
--- a/README.md
+++ b/README.md
@@ -25,13 +25,14 @@ If you need some help with your PR at any time, please feel free to @-mention an
<img src="https://avatars.githubusercontent.com/dickwall" height="50px" title="Dick Wall"/> | [`@dickwall`](https://github.com/dickwall) | process & community, documentation |
<img src="https://avatars.githubusercontent.com/dragos" height="50px" title="Iulian Dragos"/> | [`@dragos`](https://github.com/dragos) | specialization, back end |
<img src="https://avatars.githubusercontent.com/axel22" height="50px" title="Aleksandr Prokopec"/> | [`@axel22`](https://github.com/axel22) | collections, concurrency, specialization |
+ <img src="https://avatars.githubusercontent.com/janekdb" height="50px" title="Janek Bogucki"/> | [`@janekdb`](https://github.com/janekdb) | documentation |
P.S.: If you have some spare time to help out around here, we would be delighted to add your name to this list!
# Handy Links
- [A wealth of documentation](http://docs.scala-lang.org)
- [Scala CI](https://scala-ci.typesafe.com/)
- - [Download the latest nightly](http://www.scala-lang.org/files/archive/nightly/2.11.x/);
+ - [Download the latest nightly](http://www.scala-lang.org/files/archive/nightly/2.11.x/)
- [(Deprecated) Scala CI at EPFL](https://scala-webapps.epfl.ch/jenkins/)
- Scala mailing lists:
- [Compiler and standard library development](https://groups.google.com/group/scala-internals)
@@ -78,7 +79,7 @@ To pinpoint bugs, we often use git bisect, which is only effective when we can c
This facilitates reviewing: a commit that reformats code can be judged quickly not to affect anything, so we can focus on the meat of the PR. It also helps when merging between long-running branches, reducing conflicts (or providing at least a limited scope for each one).
-Please do not @mention anyone in the commit message -- that's what the PR description and comments are for. Every time a commit is shuffled through github (in a merge in some fork, say), every @mention results in an email to that person (the core team treats them as personal email, straight to their inbox, so please don't flood us :-)).
+Please do not @-mention anyone in the commit message -- that's what the PR description and comments are for. Every time a commit is shuffled through github (in a merge in some fork, say), every @-mention results in an email to that person (the core team treats them as personal email, straight to their inbox, so please don't flood us :-)).
## Reviews
@@ -91,13 +92,18 @@ To help you plan your contributions, we communicate our plans on a regular basis
## Reviewing
-Once you've gained some experience with the code base and the process, the logical next step is to offers reviews for others's contributions. The main goal of this whole process, in the end, is to ensure the health of the Scala project by improving the quality of the code base, the documentation, as well as this process itself. Thank you for doing your part!
+Once you've gained some experience with the code base and the process, the next step is to review the contributions of others.
+
+The main goal of this whole process is to ensure the health of the Scala project by improving the quality of the code base, the documentation, as well as this process itself. Thank you for doing your part!
## [Labels](https://github.com/scala/scala/labels)
- - `reviewed` automatically added by scabot when a comment prefixed with LGTM is posted
- - `welcome` reviewer / queue curator adds to welcome someone's first PR (for highlighting in the release notes)
- - `release-notes` reviewer / queue curator adds to make sure this PR is highlighted in the release notes
- - `on-hold` added when this PR should not yet be merged, even though CI is green
+
+Label | Description
+--------------- | -----------
+`reviewed` | automatically added by scabot when a comment prefixed with LGTM is posted
+`welcome` | reviewer / queue curator adds to welcome someone's first PR (for highlighting in the release notes)
+`release-notes` | reviewer / queue curator adds to make sure this PR is highlighted in the release notes
+`on-hold` | added when this PR should not yet be merged, even though CI is green
### Tips & Tricks
Once the `publish-core` task has completed on a commit, you can try it out in sbt as follows:
@@ -126,14 +132,23 @@ Use the latest IntelliJ IDEA release and install the Scala plugin from within th
The following steps are required to use IntelliJ IDEA on Scala trunk
- Run `ant init`. This will download some JARs to `./build/deps`, which are included in IntelliJ's classpath.
- - Run src/intellij/setup.sh
- - Open ./src/intellij/scala.ipr in IntelliJ
- - File, Project Settings, Project, SDK. Create an SDK entry named "1.6" containing the Java 1.6 SDK.
+ - Run `./src/intellij/setup.sh`.
+ - Open `./src/intellij/scala.ipr` in IntelliJ.
+ - `File` → `Project Structure` → `Project` → `Project SDK`. Create an SDK entry named "1.6" containing the Java 1.6 SDK.
(You may use a later SDK for local development, but the CI will verify against Java 6.)
-Compilation within IDEA is performed in "-Dlocker.skip=1" mode: the sources are built
-directly using the STARR compiler (which is downloaded from maven, according to `starr.version` in `versions.properties`).
+Compilation within IDEA is performed in `-Dlocker.skip=1` mode: the sources are built
+directly using the STARR compiler (which is downloaded from [the Central Repository](http://central.sonatype.org/), according to `starr.version` in `versions.properties`).
+
+## Building with sbt (EXPERIMENTAL)
+The experimental sbt-based build definition has arrived! Run `sbt package`
+to build the compiler. You can run `sbt test` to run unit (JUnit) tests.
+Use `sbt test/it:test` to run integration (partest) tests.
+
+We would like to migrate to sbt build as quickly as possible. If you would
+like to help please use the scala-internals mailing list to discuss your
+ideas and coordinate your effort with others.
## Building with Ant
@@ -144,25 +159,19 @@ Verify your build using `ant test-opt`.
The Scala build system is based on Apache Ant. Most required pre-compiled
libraries are part of the repository (in 'lib/'). The following however is
-assumed to be installed on the build machine:
+assumed to be installed on the build machine: TODO
-## Building with Sbt (EXPERIMENTAL)
-
-The experimental sbt-based build definition has arrived! Run `sbt package`
-to build the compiler. You can run `sbt test` to run unit (JUnit) tests.
-Use `sbt test/it:test` to run integration (partest) tests.
-
-We would like to migrate to sbt build as quickly as possible. If you would
-like to help please use the scala-internals mailing list to discuss your
-ideas and coordinate your effort with others.
-
-### Tips and tricks
+### Ant Tips and tricks
Here are some common commands. Most ant targets offer a `-opt` variant that runs under `-optimise` (CI runs the -optimize variant).
- - `./pull-binary-libs.sh` downloads all binary artifacts associated with this commit.
- - `ant -p` prints out information about the commonly used ant targets.
- - `ant` or `ant build`: A quick compilation (to build/quick) of your changes using the locker compiler.
+Command | Description
+----------------------- | -----------
+`./pull-binary-libs.sh` | downloads all binary artifacts associated with this commit.
+`ant -p` | prints out information about the commonly used ant targets.
+`ant` or `ant build` | A quick compilation (to `build/quick`) of your changes using the locker compiler.
+`ant dist` | builds a distribution in 'dists/latest'.
+`ant all.clean` | removes all build files and all distributions.
A typical debug cycle incrementally builds quick, then uses it to compile and run the file
`sandbox/test.scala` as follows:
@@ -174,17 +183,14 @@ We typically alias `build/quick/bin/scalac -d sandbox` to `qsc` and `build/quick
`ant test-opt` tests that your code is working and fit to be committed:
- Runs the test suite and bootstrapping test on quick.
- - You can run the suite only (skipping strap) with 'ant test.suite'.
+ - You can run the suite only (skipping strap) with `ant test.suite`.
`ant docs` generates the HTML documentation for the library from the sources using the scaladoc tool in quick.
-Note: on most machines this requires more heap than is allocate by default. You can adjust the parameters with ANT_OPTS. Example command line:
+Note: on most machines this requires more heap than is allocated by default. You can adjust the parameters with `ANT_OPTS`. Example command line:
+```sh
+ANT_OPTS="-Xms512M -Xmx2048M -Xss1M -XX:MaxPermSize=128M" ant docs
```
-ANT_OPTS = "-Xms512M -Xmx2048M -Xss1M -XX:MaxPermSize=128M" ant docs
-```
-
- - `ant dist` builds a distribution in 'dists/latest'.
- - `ant all.clean` Removes all build files and all distributions.
### Bootstrapping concepts
NOTE: This is somewhat outdated, but the ideas still hold.
@@ -194,7 +200,7 @@ compiles Scala in layers. Each layer is a complete compiled Scala compiler and l
A superior layer is always compiled by the layer just below it. Here is a short
description of the four layers that the build uses, from bottom to top:
- - `starr`: the stable reference Scala release. We use an official version of Scala (specified by `starr.version` in `versions.properties`), downloaded from maven central.
+ - `starr`: the stable reference Scala release. We use an official version of Scala (specified by `starr.version` in `versions.properties`), downloaded from the Central Repository.
- `locker`: the local reference which is compiled by starr and is the work compiler in a typical development cycle. Add `locker.skip=true` to `build.properties` to skip this step and speed up development when you're not changing code generation. In any case, after it has been built once, it is “frozen” in this state. Updating it to fit the current source code must be explicitly requested (`ant locker.unlock`).
- `quick`: the layer which is incrementally built when testing changes in the compiler or library. This is considered an actual new version when locker is up-to-date in relation to the source code.
- `strap`: a test layer used to check stability of the build.
diff --git a/docs/TODO b/docs/TODO
index 094202f53e..558aa87205 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -53,7 +53,7 @@
The process is about the same for symbols in PolyTypes. The main
difference is that type parameters may be referenced and thus we
- need something like De Bruijn indicies to represent these
+ need something like De Bruijn indices to represent these
references.
diff --git a/spec/01-lexical-syntax.md b/spec/01-lexical-syntax.md
index e26cb796c8..b26e5b2328 100644
--- a/spec/01-lexical-syntax.md
+++ b/spec/01-lexical-syntax.md
@@ -443,7 +443,7 @@ multiLineChars ::= {[‘"’] [‘"’] charNoDoubleQuote} {‘"’}
A multi-line string literal is a sequence of characters enclosed in
triple quotes `""" ... """`. The sequence of characters is
-arbitrary, except that it may contain three or more consuctive quote characters
+arbitrary, except that it may contain three or more consecutive quote characters
only at the very end. Characters
must not necessarily be printable; newlines or other
control characters are also permitted. Unicode escapes work as everywhere else, but none
diff --git a/spec/06-expressions.md b/spec/06-expressions.md
index 85e288bf5f..9cd58ea346 100644
--- a/spec/06-expressions.md
+++ b/spec/06-expressions.md
@@ -1736,7 +1736,7 @@ so `scala.Any` is the type inferred for `a`.
_Eta-expansion_ converts an expression of method type to an
equivalent expression of function type. It proceeds in two steps.
-First, one identifes the maximal sub-expressions of $e$; let's
+First, one identifies the maximal sub-expressions of $e$; let's
say these are $e_1 , \ldots , e_m$. For each of these, one creates a
fresh name $x_i$. Let $e'$ be the expression resulting from
replacing every maximal subexpression $e_i$ in $e$ by the
diff --git a/spec/07-implicits.md b/spec/07-implicits.md
index 5e10373959..726320ed33 100644
--- a/spec/07-implicits.md
+++ b/spec/07-implicits.md
@@ -84,7 +84,7 @@ The _parts_ of a type $T$ are:
- if $T$ is an abstract type, the parts of its upper bound;
- if $T$ denotes an implicit conversion to a type with a method with argument types $T_1 , \ldots , T_n$ and result type $U$,
the union of the parts of $T_1 , \ldots , T_n$ and $U$;
-- the parts of quantified (existential or univeral) and annotated types are defined as the parts of the underlying types (e.g., the parts of `T forSome { ... }` are the parts of `T`);
+- the parts of quantified (existential or universal) and annotated types are defined as the parts of the underlying types (e.g., the parts of `T forSome { ... }` are the parts of `T`);
- in all other cases, just $T$ itself.
Note that packages are internally represented as classes with companion modules to hold the package members.
diff --git a/spec/12-the-scala-standard-library.md b/spec/12-the-scala-standard-library.md
index e76035f458..8f65191312 100644
--- a/spec/12-the-scala-standard-library.md
+++ b/spec/12-the-scala-standard-library.md
@@ -171,7 +171,7 @@ Any numeric value type $T$ supports the following methods.
evaluated by converting the receiver and its argument to their
operation type and performing the given arithmetic operation of that
type.
- * Parameterless arithmethic methods identity (`+`) and negation
+ * Parameterless arithmetic methods identity (`+`) and negation
(`-`), with result type $T$. The first of these returns the
receiver unchanged, whereas the second returns its negation.
* Conversion methods `toByte`, `toShort`, `toChar`,
@@ -194,7 +194,7 @@ Integer numeric value types support in addition the following operations:
operation of that type.
* A parameterless bit-negation method (`~`). Its result type is
- the reciver type $T$ or `Int`, whichever is larger.
+ the receiver type $T$ or `Int`, whichever is larger.
The operation is evaluated by converting the receiver to the result
type and negating every bit in its value.
* Bit-shift methods left-shift (`<<`), arithmetic right-shift
@@ -745,7 +745,7 @@ object Predef {
def readf2(format: String) = Console.readf2(format)
def readf3(format: String) = Console.readf3(format)
- // Implict conversions ------------------------------------------------
+ // Implicit conversions ------------------------------------------------
...
}
diff --git a/spec/15-changelog.md b/spec/15-changelog.md
index 3c8739359a..751a571ecc 100644
--- a/spec/15-changelog.md
+++ b/spec/15-changelog.md
@@ -31,7 +31,7 @@ formal parameter types. Added section on
[numeric widening](06-expressions.html#numeric-widening) to support
weak conformance.
-Tightened rules to avoid accidential [overrides](05-classes-and-objects.html#overriding).
+Tightened rules to avoid accidental [overrides](05-classes-and-objects.html#overriding).
Removed class literals.
@@ -53,7 +53,7 @@ has been brought in line with. From now on `+=`, has the same precedence as `=`.
#### Wildcards as function parameters
-A formal parameter to an anonymous fucntion may now be a
+A formal parameter to an anonymous function may now be a
[wildcard represented by an underscore](06-expressions.html#placeholder-syntax-for-anonymous-functions).
> _ => 7 // The function that ignores its argument
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala
index 4421c7a07a..11602f52a2 100644
--- a/src/actors/scala/actors/Future.scala
+++ b/src/actors/scala/actors/Future.scala
@@ -12,7 +12,7 @@ package scala.actors
import scala.actors.scheduler.DaemonScheduler
import scala.concurrent.SyncVar
-/** A function of arity 0, returing a value of type `T` that,
+/** A function of arity 0, returning a value of type `T` that,
* when applied, blocks the current actor (`Actor.self`)
* until the future's value is available.
*
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index bf53c47e9a..332acf4a26 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -261,7 +261,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
* Create a method based on a Function
*
* Used both to under `-Ydelambdafy:method` create a lifted function and
- * under `-Ydelamdafy:inline` to create the apply method on the anonymous
+ * under `-Ydelambdafy:inline` to create the apply method on the anonymous
* class.
*
* It creates a method definition with value params cloned from the
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 4f195c2985..70abdf6bc0 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2031,11 +2031,11 @@ self =>
/** Drop `private` modifier when followed by a qualifier.
* Contract `abstract` and `override` to ABSOVERRIDE
*/
- private def normalizeModifers(mods: Modifiers): Modifiers =
+ private def normalizeModifiers(mods: Modifiers): Modifiers =
if (mods.isPrivate && mods.hasAccessBoundary)
- normalizeModifers(mods &~ Flags.PRIVATE)
+ normalizeModifiers(mods &~ Flags.PRIVATE)
else if (mods hasAllFlags (Flags.ABSTRACT | Flags.OVERRIDE))
- normalizeModifers(mods &~ (Flags.ABSTRACT | Flags.OVERRIDE) | Flags.ABSOVERRIDE)
+ normalizeModifiers(mods &~ (Flags.ABSTRACT | Flags.OVERRIDE) | Flags.ABSOVERRIDE)
else
mods
@@ -2080,7 +2080,7 @@ self =>
* AccessModifier ::= (private | protected) [AccessQualifier]
* }}}
*/
- def accessModifierOpt(): Modifiers = normalizeModifers {
+ def accessModifierOpt(): Modifiers = normalizeModifiers {
in.token match {
case m @ (PRIVATE | PROTECTED) => in.nextToken() ; accessQualifierOpt(Modifiers(flagTokens(m)))
case _ => NoMods
@@ -2094,7 +2094,7 @@ self =>
* | override
* }}}
*/
- def modifiers(): Modifiers = normalizeModifers {
+ def modifiers(): Modifiers = normalizeModifiers {
def loop(mods: Modifiers): Modifiers = in.token match {
case PRIVATE | PROTECTED =>
loop(accessQualifierOpt(addMod(mods, flagTokens(in.token), tokenRange(in))))
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 3e23291e92..b6f9bcc9ab 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -2016,7 +2016,7 @@ abstract class GenICode extends SubComponent {
*
* This could result in unreachable code which has to be cleaned up later, e.g. if the try and all the exception
* handlers always end in RETURN then there will be no "normal" flow out of the try/catch/finally.
- * Later reachability analysis will remove unreacahble code.
+ * Later reachability analysis will remove unreachable code.
*/
def Try(body: Context => Context,
handlers: List[(Symbol, TypeKind, Context => Context)],
@@ -2060,7 +2060,7 @@ abstract class GenICode extends SubComponent {
if (settings.YdisableUnreachablePrevention || !outerCtx.bb.ignore) {
if (finalizer != EmptyTree) {
val exh = outerCtx.newExceptionHandler(NoSymbol, finalizer.pos) // finalizer covers exception handlers
- this.addActiveHandler(exh) // .. and body aswell
+ this.addActiveHandler(exh) // .. and body as well
val exhStartCtx = finalizerCtx.enterExceptionHandler(exh)
exhStartCtx.bb killIf outerCtx.bb.ignore
val exception = exhStartCtx.makeLocal(finalizer.pos, ThrowableTpe, "exc")
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
index 843648282b..0f17b5d694 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
@@ -20,7 +20,7 @@ abstract class ICodeCheckers {
* </p>
* <ul>
* <li>
- * for primitive operations: the type and numer of operands match
+ * for primitive operations: the type and number of operands match
* the type of the operation
* </li>
* <li>
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index 67fc7923ea..416628d5ba 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -92,8 +92,8 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
def genThrow(expr: Tree): BType = {
val thrownKind = tpeTK(expr)
- // `throw null` is valid although scala.Null (as defined in src/libray-aux) isn't a subtype of Throwable.
- // Similarly for scala.Nothing (again, as defined in src/libray-aux).
+ // `throw null` is valid although scala.Null (as defined in src/library-aux) isn't a subtype of Throwable.
+ // Similarly for scala.Nothing (again, as defined in src/library-aux).
assert(thrownKind.isNullType || thrownKind.isNothingType || thrownKind.asClassBType.isSubtypeOf(ThrowableReference).get)
genLoad(expr, thrownKind)
lineNumber(expr)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
index 8720da84e8..0c26e01322 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
@@ -1126,7 +1126,7 @@ object BTypes {
* The map is indexed by the string s"$name$descriptor" (to
* disambiguate overloads).
*
- * @param warning Contains an warning message if an error occured when building this
+ * @param warning Contains an warning message if an error occurred when building this
* InlineInfo, for example if some classfile could not be found on
* the classpath. This warning can be reported later by the inliner.
*/
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala
index 31710dcbee..31b62f747e 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala
@@ -12,7 +12,7 @@ import scala.tools.nsc.backend.jvm.opt.BytecodeUtils
import BytecodeUtils._
/**
- * Some notes on the ASM ananlyzer framework.
+ * Some notes on the ASM analyzer framework.
*
* Value
* - Abstract, needs to be implemented for each analysis.
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala
index 92b9b34006..b0dc6ead1b 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala
@@ -359,7 +359,7 @@ class ClosureOptimizer[BT <: BTypes](val btypes: BT) {
}
/**
- * Stores a local varaible index the opcode offset required for operating on that variable.
+ * Stores a local variable index the opcode offset required for operating on that variable.
*
* The xLOAD / xSTORE opcodes are in the following sequence: I, L, F, D, A, so the offset for
* a local variable holding a reference (`A`) is 4. See also method `getOpcode` in [[scala.tools.asm.Type]].
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
index 8477f5461a..2c4a0ad3c3 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
@@ -366,7 +366,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
clonedInstructions.insert(argStores)
- // label for the exit of the inlined functions. xRETURNs are rplaced by GOTOs to this label.
+ // label for the exit of the inlined functions. xRETURNs are replaced by GOTOs to this label.
val postCallLabel = newLabelNode
clonedInstructions.add(postCallLabel)
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index 86685d46de..6a46c65267 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -137,7 +137,7 @@ abstract class Constructors extends Statics with Transform with ast.TreeDSL {
* and thus may only be accessed from value or method definitions owned by the current class
* (ie there's no point drilling down into nested classes).
*
- * (d) regarding candidates in (b), they are accesible from all places listed in (c) and in addition
+ * (d) regarding candidates in (b), they are accessible from all places listed in (c) and in addition
* from nested classes (nested at any number of levels).
*
* In all cases, we're done with traversing as soon as all candidates have been ruled out.
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 99dd81c7e2..3ed128cbc5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -55,6 +55,13 @@ trait Macros extends MacroRuntimes with Traces with Helpers {
def globalSettings = global.settings
+ /** Obtains a `ClassLoader` instance used for macro expansion.
+ *
+ * By default a new `ScalaClassLoader` is created using the classpath
+ * from global and the classloader of self as parent.
+ *
+ * Mirrors with runtime definitions (e.g. Repl) need to adjust this method.
+ */
protected def findMacroClassLoader(): ClassLoader = {
val classpath = global.classPath.asURLs
macroLogVerbose("macro classloader: initializing from -cp: %s".format(classpath))
@@ -658,7 +665,7 @@ trait Macros extends MacroRuntimes with Traces with Helpers {
//
// Situation #2 requires measures to be taken. If we're in it, then noone's going to help us infer
// the undetermined type params. Therefore we need to do something ourselves or otherwise this
- // expandee will forever remaing not expanded (see SI-5692). A traditional way out of this conundrum
+ // expandee will forever remain not expanded (see SI-5692). A traditional way out of this conundrum
// is to call `instantiate` and let the inferencer try to find the way out. It works for simple cases,
// but sometimes, if the inferencer lacks information, it will be forced to approximate.
//
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index a7046e45e0..8113cd9b96 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3305,7 +3305,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
// https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.3
//
// One can think of these methods as being infinitely overloaded. We create
- // a ficticious new cloned method symbol for each call site that takes on a signature
+ // a fictitious new cloned method symbol for each call site that takes on a signature
// governed by a) the argument types and b) the expected type
val args1 = typedArgs(args, forArgMode(fun, mode))
val pts = args1.map(_.tpe.deconst)
@@ -4106,7 +4106,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
def resultingTypeTree(tpe: Type) = {
// we need symbol-ful originals for reification
- // hence we go the extra mile to hand-craft tis guy
+ // hence we go the extra mile to hand-craft this guy
val original = arg1 match {
case tt @ TypeTree() if tt.original != null => Annotated(ann, tt.original)
// this clause is needed to correctly compile stuff like "new C @D" or "@(inline @getter)"
@@ -4258,7 +4258,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
// in the special (though common) case where the types are equal, it pays to pack before comparing
// especially virtpatmat needs more aggressive unification of skolemized types
// this breaks src/library/scala/collection/immutable/TrieIterator.scala
- // annotated types need to be lubbed regardless (at least, continations break if you by pass them like this)
+ // annotated types need to be lubbed regardless (at least, continuations break if you bypass them like this)
def samePackedTypes = (
!isPastTyper
&& thenp1.tpe.annotations.isEmpty
diff --git a/src/compiler/scala/tools/reflect/ReflectGlobal.scala b/src/compiler/scala/tools/reflect/ReflectGlobal.scala
index ac63232967..e30d1ed7cd 100644
--- a/src/compiler/scala/tools/reflect/ReflectGlobal.scala
+++ b/src/compiler/scala/tools/reflect/ReflectGlobal.scala
@@ -1,9 +1,11 @@
package scala.tools
package reflect
+import scala.reflect.internal.util.ScalaClassLoader
import scala.tools.nsc.Global
import scala.tools.nsc.reporters.Reporter
import scala.tools.nsc.Settings
+import scala.tools.nsc.typechecker.Analyzer
/** A version of Global that uses reflection to get class
* infos, instead of reading class or source files.
@@ -11,6 +13,20 @@ import scala.tools.nsc.Settings
class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader)
extends Global(currentSettings, reporter) with scala.tools.reflect.ReflectSetup with scala.reflect.runtime.SymbolTable {
+ override lazy val analyzer = new {
+ val global: ReflectGlobal.this.type = ReflectGlobal.this
+ } with Analyzer {
+ /** Obtains the classLoader used for runtime macro expansion.
+ *
+ * Macro expansion can use everything available in [[global.classPath]] or [[rootClassLoader]].
+ * The [[rootClassLoader]] is used to obtain runtime defined macros.
+ */
+ override protected def findMacroClassLoader(): ClassLoader = {
+ val classpath = global.classPath.asURLs
+ ScalaClassLoader.fromURLs(classpath, rootClassLoader)
+ }
+ }
+
override def transformedType(sym: Symbol) =
postErasure.transformInfo(sym,
erasure.transformInfo(sym,
diff --git a/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java b/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java
index 19237c9092..a7ef492057 100644
--- a/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java
+++ b/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java
@@ -24,7 +24,7 @@ import java.util.Random;
* {@code ThreadLocalRandom.current().nextX(...)} (where
* {@code X} is {@code Int}, {@code Long}, etc).
* When all usages are of this form, it is never possible to
- * accidently share a {@code ThreadLocalRandom} across multiple threads.
+ * accidentally share a {@code ThreadLocalRandom} across multiple threads.
*
* <p>This class also provides additional commonly used bounded random
* generation methods.
diff --git a/src/library/scala/Equals.scala b/src/library/scala/Equals.scala
index f2f9ead44c..e06557ccdd 100644
--- a/src/library/scala/Equals.scala
+++ b/src/library/scala/Equals.scala
@@ -13,8 +13,9 @@ package scala
*/
trait Equals extends Any {
/** A method that should be called from every well-designed equals method
- * that is open to be overridden in a subclass. See Programming in Scala,
- * Chapter 28 for discussion and design.
+ * that is open to be overridden in a subclass. See
+ * [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala,
+ * Chapter 28]] for discussion and design.
*
* @param that the value being probed for possible equality
* @return true if this instance can possibly equal `that`, otherwise false
diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala
index 6851ab6bc7..27b2bfdde7 100644
--- a/src/library/scala/collection/immutable/HashSet.scala
+++ b/src/library/scala/collection/immutable/HashSet.scala
@@ -194,6 +194,7 @@ class HashSet[A] extends AbstractSet[A]
protected def writeReplace(): AnyRef = new HashSet.SerializationProxy(this)
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[HashSet[B]]
}
/** $factoryInfo
diff --git a/src/library/scala/collection/immutable/ListSet.scala b/src/library/scala/collection/immutable/ListSet.scala
index 2e17677359..adc975479a 100644
--- a/src/library/scala/collection/immutable/ListSet.scala
+++ b/src/library/scala/collection/immutable/ListSet.scala
@@ -179,4 +179,6 @@ class ListSet[A] extends AbstractSet[A]
override def tail: ListSet[A] = self
}
+
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[ListSet[B]]
}
diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala
index 94a5b7929a..bd5b9c9faf 100644
--- a/src/library/scala/collection/immutable/MapLike.scala
+++ b/src/library/scala/collection/immutable/MapLike.scala
@@ -113,6 +113,11 @@ self =>
override def - (elem: A): immutable.Set[A] =
if (this(elem)) immutable.Set[A]() ++ this - elem
else this
+
+ // ImmutableDefaultKeySet is only protected, so we won't warn on override.
+ // Someone could override in a way that makes widening not okay
+ // (e.g. by overriding +, though the version in this class is fine)
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
}
/** This function transforms all the values of mappings contained
diff --git a/src/library/scala/collection/immutable/Set.scala b/src/library/scala/collection/immutable/Set.scala
index 0fbf7942d4..a115469b83 100644
--- a/src/library/scala/collection/immutable/Set.scala
+++ b/src/library/scala/collection/immutable/Set.scala
@@ -35,12 +35,22 @@ trait Set[A] extends Iterable[A]
override def companion: GenericCompanion[Set] = Set
- /** Returns this $coll as an immutable map.
- *
- * A new map will not be built; lazy collections will stay lazy.
+ /** Returns this $coll as an immutable set, perhaps accepting a
+ * wider range of elements. Since it already is an
+ * immutable set, it will only be rebuilt if the underlying structure
+ * cannot be expanded to include arbitrary element types.
+ * For instance, `BitSet` and `SortedSet` will be rebuilt, as
+ * they require `Int` and sortable elements respectively.
+ *
+ * When in doubt, the set will be rebuilt. Rebuilt sets never
+ * need to be rebuilt again.
*/
- @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0")
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
+ override def toSet[B >: A]: Set[B] = {
+ // This way of building sets typically has the best benchmarks, surprisingly!
+ val sb = Set.newBuilder[B]
+ foreach(sb += _)
+ sb.result()
+ }
override def seq: Set[A] = this
protected override def parCombiner = ParSet.newCombiner[A] // if `immutable.SetLike` gets introduced, please move this there!
@@ -62,6 +72,7 @@ object Set extends ImmutableSetFactory[Set] {
def - (elem: Any): Set[Any] = this
def iterator: Iterator[Any] = Iterator.empty
override def foreach[U](f: Any => U): Unit = {}
+ override def toSet[B >: Any]: Set[B] = this.asInstanceOf[Set[B]]
}
private[collection] def emptyInstance: Set[Any] = EmptySet
@@ -92,6 +103,10 @@ object Set extends ImmutableSetFactory[Set] {
if (f(elem1)) Some(elem1)
else None
}
+ // Why is Set1 non-final? Need to fix that!
+ @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8")
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set1[B]]
+
}
/** An optimized representation for immutable sets of size 2 */
@@ -123,6 +138,9 @@ object Set extends ImmutableSetFactory[Set] {
else if (f(elem2)) Some(elem2)
else None
}
+ // Why is Set2 non-final? Need to fix that!
+ @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8")
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set2[B]]
}
/** An optimized representation for immutable sets of size 3 */
@@ -156,6 +174,9 @@ object Set extends ImmutableSetFactory[Set] {
else if (f(elem3)) Some(elem3)
else None
}
+ // Why is Set3 non-final? Need to fix that!
+ @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8")
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set3[B]]
}
/** An optimized representation for immutable sets of size 4 */
@@ -191,6 +212,9 @@ object Set extends ImmutableSetFactory[Set] {
else if (f(elem4)) Some(elem4)
else None
}
+ // Why is Set4 non-final? Need to fix that!
+ @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8")
+ override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set4[B]]
}
}
diff --git a/src/library/scala/collection/immutable/SortedMap.scala b/src/library/scala/collection/immutable/SortedMap.scala
index f1493551ab..682788e18e 100644
--- a/src/library/scala/collection/immutable/SortedMap.scala
+++ b/src/library/scala/collection/immutable/SortedMap.scala
@@ -53,6 +53,12 @@ self =>
val map = self.rangeImpl(from, until)
new map.DefaultKeySortedSet
}
+ override def toSet[C >: A]: Set[C] = {
+ // This way of building sets typically has the best benchmarks, surprisingly!
+ val sb = Set.newBuilder[C]
+ foreach(sb += _)
+ sb.result()
+ }
}
/** Add a key/value pair to this map.
diff --git a/src/library/scala/util/Sorting.scala b/src/library/scala/util/Sorting.scala
index ee2bdbc4a7..b4f965f69b 100644
--- a/src/library/scala/util/Sorting.scala
+++ b/src/library/scala/util/Sorting.scala
@@ -88,7 +88,7 @@ object Sorting {
a(pL - 1) = current
pL -= 1
case x if x < 0 =>
- // Already in place. Just update indicies.
+ // Already in place. Just update indices.
iA += 1
case _ if iB > pR =>
// Wrong side. There's room on the other side, so swap
diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala
index cd7648a44a..f9b49f1730 100644
--- a/src/reflect/scala/reflect/api/Types.scala
+++ b/src/reflect/scala/reflect/api/Types.scala
@@ -588,7 +588,7 @@ trait Types {
/** An extractor class to create and pattern match with syntax `TypeRef(pre, sym, args)`
* Here, `pre` is the prefix of the type reference, `sym` is the symbol
* referred to by the type reference, and `args` is a possible empty list of
- * type argumenrts.
+ * type arguments.
* @group Extractors
*/
abstract class TypeRefExtractor {
diff --git a/src/reflect/scala/reflect/internal/Kinds.scala b/src/reflect/scala/reflect/internal/Kinds.scala
index 8ae201f045..902ba9fa80 100644
--- a/src/reflect/scala/reflect/internal/Kinds.scala
+++ b/src/reflect/scala/reflect/internal/Kinds.scala
@@ -237,7 +237,7 @@ trait Kinds {
*
* Proper types are represented using ProperTypeKind.
*
- * Type constructors are reprented using TypeConKind.
+ * Type constructors are represented using TypeConKind.
*/
abstract class Kind {
import Kind.StringState
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 56fb1181fe..2e3449588b 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -2113,7 +2113,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
/** The package class containing this symbol, or NoSymbol if there
* is not one.
* TODO: formulate as enclosingSuchThat, after making sure
- * we can start with current symbol rather than onwner.
+ * we can start with current symbol rather than owner.
* TODO: Also harmonize with enclClass, enclMethod etc.
*/
def enclosingPackageClass: Symbol = {
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index e3f95f9fd8..498e7bddd0 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -1601,7 +1601,7 @@ trait Trees extends api.Trees {
case _ =>
// no special handling is required for Function or Import nodes here.
// as they don't have interesting infos attached to their symbols.
- // Subsitution of the referenced symbol of Return nodes is handled
+ // Substitution of the referenced symbol of Return nodes is handled
// in .ChangeOwnerTraverser
}
tree match {
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala
index 06ae179da9..3b54f5274e 100644
--- a/src/repl/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala
@@ -133,7 +133,6 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
}
catch AbstractOrMissingHandler()
}
- private def tquoted(s: String) = "\"\"\"" + s + "\"\"\""
private val logScope = scala.sys.props contains "scala.repl.scope"
private def scopelog(msg: String) = if (logScope) Console.err.println(msg)
@@ -905,7 +904,10 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
def path = originalPath("$intp")
def envLines = {
if (!isReplPower) Nil // power mode only for now
- else List("def %s = %s".format("$line", tquoted(originalLine)), "def %s = Nil".format("$trees"))
+ else {
+ val escapedLine = Constant(originalLine).escapedStringValue
+ List(s"""def $$line = $escapedLine """, """def $trees = _root_.scala.Nil""")
+ }
}
def preamble = s"""
|$headerPreamble
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 b5375558ac..6b13a02c54 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
@@ -781,7 +781,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp
if (isReduced) NodeSeq.Empty else {
def paramsToHtml(vlsss: List[List[ValueParam]]): NodeSeq = {
def param0(vl: ValueParam): NodeSeq =
- // notice the }{ in the next lines, they are necessary to avoid an undesired withspace in output
+ // notice the }{ in the next lines, they are necessary to avoid an undesired whitespace in output
<span name={ vl.name }>{
Text(vl.name)
}{ Text(": ") ++ typeToHtml(vl.resultType, hasLinks) }{
diff --git a/test/files/neg/name-lookup-stable.check b/test/files/neg/name-lookup-stable.check
index 751df9505e..68d98c4162 100644
--- a/test/files/neg/name-lookup-stable.check
+++ b/test/files/neg/name-lookup-stable.check
@@ -6,6 +6,6 @@ import ColumnOption._
name-lookup-stable.scala:17: error: reference to PrimaryKey is ambiguous;
it is both defined in class A and imported subsequently by
import ColumnOption._
- PrimaryKey // was already ambigious in 2.10.3
+ PrimaryKey // was already ambiguous in 2.10.3
^
two errors found
diff --git a/test/files/neg/name-lookup-stable.scala b/test/files/neg/name-lookup-stable.scala
index 0d862f06e1..2941e05875 100644
--- a/test/files/neg/name-lookup-stable.scala
+++ b/test/files/neg/name-lookup-stable.scala
@@ -14,7 +14,7 @@ class A {
(null: Any) match { case PrimaryKey => }
- PrimaryKey // was already ambigious in 2.10.3
+ PrimaryKey // was already ambiguous in 2.10.3
}
}
diff --git a/test/files/neg/t5376.scala b/test/files/neg/t5376.scala
index 8da3868566..b1ba41bd54 100644
--- a/test/files/neg/t5376.scala
+++ b/test/files/neg/t5376.scala
@@ -12,7 +12,7 @@ object Test {
"a": Int
}
- // Import one implict and one non-implicit method with the
+ // Import one implicit and one non-implicit method with the
// same name in the same scope.
def m2 = {
import O1._
diff --git a/test/files/neg/t8597b.scala b/test/files/neg/t8597b.scala
index b29d591cb1..cbf0bf1c5a 100644
--- a/test/files/neg/t8597b.scala
+++ b/test/files/neg/t8597b.scala
@@ -4,7 +4,7 @@ object Unchecked {
// t is a fresh pattern type variable, despite our attempts to
// backtick our way to the enclosing `t`. Under this interpretation,
- // the absense of an unchecked warning is expected.
+ // the absence of an unchecked warning is expected.
(null: Any) match {
case _: Some[t] => // no warn
}
diff --git a/test/files/neg/t8675b.scala b/test/files/neg/t8675b.scala
index bffed2141c..b2212fa234 100644
--- a/test/files/neg/t8675b.scala
+++ b/test/files/neg/t8675b.scala
@@ -9,7 +9,7 @@ object Test {
}
trait Reportable1[Params, R]
- // "missing paramater type" error was swallowed in 2.11.0 leading to a crash
+ // "missing parameter type" error was swallowed in 2.11.0 leading to a crash
// in the backend.
//
// This error is itself a regression (or at least a change) in 2.11.0-M7,
diff --git a/test/files/neg/virtpatmat_exhaust_compound.scala b/test/files/neg/virtpatmat_exhaust_compound.scala
index 386c7af98d..4ff04dd06a 100644
--- a/test/files/neg/virtpatmat_exhaust_compound.scala
+++ b/test/files/neg/virtpatmat_exhaust_compound.scala
@@ -10,7 +10,7 @@ case object O3 extends Base2
case object O4 extends Base with Base2
object Test {
- val a /*: Product with Serialiable with Base */ = if (true) O1 else O2
+ val a /*: Product with Serializable with Base */ = if (true) O1 else O2
a match {
case null =>
}
diff --git a/test/files/pos/t2405.scala b/test/files/pos/t2405.scala
index 224b2ce83b..0bc7a771b2 100644
--- a/test/files/pos/t2405.scala
+++ b/test/files/pos/t2405.scala
@@ -6,14 +6,14 @@ object Test1 {
implicitly[Int]
}
-// Testing for the absense of shadowing #1.
+// Testing for the absence of shadowing #1.
object Test2 {
import A.{x => y}
val x = 2
implicitly[Int]
}
-// Testing for the absense of shadowing #2.
+// Testing for the absence of shadowing #2.
object Test3 {
{
import A.{x => y}
diff --git a/test/files/pos/t8002-nested-scope.scala b/test/files/pos/t8002-nested-scope.scala
index a2088bce7a..8ce809e556 100644
--- a/test/files/pos/t8002-nested-scope.scala
+++ b/test/files/pos/t8002-nested-scope.scala
@@ -1,5 +1,5 @@
// This test serves to capture the status quo, but should really
-// emit an accessibiltiy error.
+// emit an accessibility error.
// `Namers#companionSymbolOf` seems too lenient, and currently doesn't
// implement the same-scope checks mentioned:
diff --git a/test/files/run/dead-code-elimination.scala b/test/files/run/dead-code-elimination.scala
index fd3f2a996a..2291b22f7a 100644
--- a/test/files/run/dead-code-elimination.scala
+++ b/test/files/run/dead-code-elimination.scala
@@ -10,7 +10,7 @@
// the stack after code elimination.
//
// Originally, this did not compile, but I included it in the run
-// tests because this was ASM-dependand and did not happen for GenJVM.
+// tests because this was ASM-dependent and did not happen for GenJVM.
//
// Thus, we run the code and force the loading of class B -- if the
// bytecode is incorrect, it will fail the test.
diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala
index 7fb4a04546..4159dbdf91 100644
--- a/test/files/run/names-defaults.scala
+++ b/test/files/run/names-defaults.scala
@@ -192,7 +192,7 @@ object Test extends App {
println(argName) // should be 4
test5 { argName = 5 }
println(argName) // should be 5
- val a: Unit = test1(a = 10, b = "2") // local values a and b exist, but not ambiuous since they're val's
+ val a: Unit = test1(a = 10, b = "2") // local values a and b exist, but it's not ambiguous since they're vals
// dependent types and copy method
diff --git a/test/files/run/nothingTypeNoOpt.scala b/test/files/run/nothingTypeNoOpt.scala
index 5c5a20fa3b..454539a4b1 100644
--- a/test/files/run/nothingTypeNoOpt.scala
+++ b/test/files/run/nothingTypeNoOpt.scala
@@ -26,7 +26,7 @@ class C {
}
def f5(x: Boolean) = {
- // stack heights need to be the smae. ??? looks to the jvm like returning a value of
+ // stack heights need to be the same. ??? looks to the jvm like returning a value of
// type Nothing$, need to drop or throw it.
println(
if (x) { ???; 10 }
diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check
index 2a7b7783d9..4e030bd9fa 100644
--- a/test/files/run/repl-power.check
+++ b/test/files/run/repl-power.check
@@ -25,4 +25,7 @@ m: $r.treedsl.global.Literal = 10
scala> typed(m).tpe // typed is in scope
res2: $r.treedsl.global.Type = Int(10)
+scala> """escaping is hard, m'kah"""
+res3: String = escaping is hard, m'kah
+
scala> :quit
diff --git a/test/files/run/repl-power.scala b/test/files/run/repl-power.scala
index 4dfeb37885..5ecaad8723 100644
--- a/test/files/run/repl-power.scala
+++ b/test/files/run/repl-power.scala
@@ -1,7 +1,9 @@
import scala.tools.partest.ReplTest
object Test extends ReplTest {
- def code = """
+ def tripleQuote(s: String) = "\"\"\"" + s + "\"\"\""
+
+ def code = s"""
:power
// guarding against "error: reference to global is ambiguous"
global.emptyValDef // "it is imported twice in the same scope by ..."
@@ -9,5 +11,6 @@ val tp = ArrayClass[scala.util.Random] // magic with tags
tp.memberType(Array_apply) // evidence
val m = LIT(10) // treedsl
typed(m).tpe // typed is in scope
+${tripleQuote("escaping is hard, m'kah")}
""".trim
}
diff --git a/test/files/run/t8047.scala b/test/files/run/t8047.scala
index f5660541e8..9ec8c1dc56 100644
--- a/test/files/run/t8047.scala
+++ b/test/files/run/t8047.scala
@@ -1,7 +1,7 @@
object Test extends App {
import scala.reflect.runtime.universe._
//
- // x's owner is outer Test scope. Previosly the quasiquote expansion
+ // x's owner is outer Test scope. Previously the quasiquote expansion
// looked like:
//
// object Test {
diff --git a/test/files/run/toolbox_expand_macro.check b/test/files/run/toolbox_expand_macro.check
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/test/files/run/toolbox_expand_macro.check
@@ -0,0 +1 @@
+42
diff --git a/test/files/run/toolbox_expand_macro.scala b/test/files/run/toolbox_expand_macro.scala
new file mode 100644
index 0000000000..a52e449168
--- /dev/null
+++ b/test/files/run/toolbox_expand_macro.scala
@@ -0,0 +1,23 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox}
+
+object Test extends App {
+ val toolBox = cm.mkToolBox()
+ val x = 21
+ val runtimeMacro =
+ q"""object RuntimeMacro {
+ import scala.reflect.macros.whitebox.Context
+ import scala.language.experimental.macros
+
+ def add(y: Int): Int = macro addImpl
+ def addImpl(c: Context)(y: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ val x = $x
+ c.Expr[Int](q"$$x + $$y")
+ }
+ }"""
+ val s = toolBox.define(runtimeMacro)
+ println(toolBox.eval(q"$s.add(21)"))
+}
diff --git a/test/junit/scala/collection/immutable/SetTests.scala b/test/junit/scala/collection/immutable/SetTests.scala
new file mode 100644
index 0000000000..28c7864359
--- /dev/null
+++ b/test/junit/scala/collection/immutable/SetTests.scala
@@ -0,0 +1,81 @@
+package scala.collection.immutable
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(classOf[JUnit4])
+class SetTests {
+ @Test
+ def test_SI8346_toSet_soundness(): Unit = {
+ val any2stringadd = "Disabled string conversions so as not to get confused!"
+
+ def any[A](set: Set[A]): Set[Any] = {
+ val anyset = set.toSet[Any]
+ assert((anyset + "fish") contains "fish")
+ anyset
+ }
+
+ // Make sure default immutable Set does not rebuild itself on widening with toSet
+ // Need to cover 0, 1, 2, 3, 4 elements as special cases
+ var si = Set.empty[Int]
+ assert(si eq si.toSet[Any])
+ for (i <- 1 to 5) {
+ val s1 = Set(Array.range(1, i+1): _*)
+ val s2 = si + i
+ val s1a = any(s1)
+ val s2a = any(s2)
+ assert(s1 eq s1a)
+ assert(s2 eq s2a)
+ si = s2
+ }
+
+ // Make sure BitSet correctly rebuilds itself on widening with toSet
+ // Need to cover empty, values 0-63, values 0-127 as special cases
+ val bitsets = Seq(BitSet.empty, BitSet(23), BitSet(23, 99), BitSet(23, 99, 141))
+ bitsets.foreach{ b =>
+ val ba = any(b)
+ assert(b ne ba)
+ assertEquals(b, ba)
+ }
+
+ // Make sure HashSet (and by extension, its implementing class HashTrieSet)
+ // does not rebuild itself on widening by toSet
+ val hashset = HashSet(1, 3, 5, 7)
+ val hashseta = any(hashset)
+ assert(hashset eq hashseta)
+
+ // Make sure ListSet does not rebuild itself on widening by toSet
+ // (Covers Node also, since it subclasses ListSet)
+ val listset = ListSet(1, 3, 5, 7)
+ val listseta = any(listset)
+ assert(listset eq listseta)
+
+ // Make sure SortedSets correctly rebuild themselves on widening with toSet
+ // Covers TreeSet and keySet of SortedMap also
+ val sortedsets = Seq(
+ SortedSet.empty[Int], SortedSet(5), SortedSet(1,2,3,5,4),
+ SortedMap(1 -> "cod", 2 -> "herring").keySet
+ )
+ sortedsets.foreach{ set =>
+ val seta = any(set)
+ assert(set ne seta)
+ assertEquals(set, seta)
+ }
+
+ // Make sure ValueSets correctly rebuild themselves on widening with toSet
+ object WeekDay extends Enumeration {
+ type WeekDay = Value
+ val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
+ }
+ val valuesa = any(WeekDay.values)
+ assert(WeekDay.values ne valuesa)
+ assertEquals(WeekDay.values, valuesa)
+
+ // Make sure regular Map keySets do not rebuild themselves on widening with toSet
+ val mapset = Map(1 -> "cod", 2 -> "herring").keySet
+ val mapseta = any(mapset)
+ assert(mapset eq mapseta)
+ }
+}
diff --git a/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala
index a5b3faced8..941a167114 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala
@@ -204,7 +204,7 @@ class ProdConsAnalyzerTest extends ClearAfterClass {
def iincProdCons(): Unit = {
import Opcodes._
val m = genMethod(descriptor = "(I)I")(
- Incr(IINC, 1, 1), // producer and cosumer of local variable 1
+ Incr(IINC, 1, 1), // producer and consumer of local variable 1
VarOp(ILOAD, 1),
Op(IRETURN)
)
diff --git a/versions.properties b/versions.properties
index c3270736d8..a2f74bbd08 100644
--- a/versions.properties
+++ b/versions.properties
@@ -5,7 +5,7 @@
# also add them to the update.versions mechanism in build.xml,
# which is used by the release script scripts/jobs/integrate/bootstrap
-# The scala version used for boostrapping. This has no impact on the final classfiles:
+# The scala version used for bootstrapping. This has no impact on the final classfiles:
# there are two stages (locker and quick), so compiler and library are always built
# with themselves. Stability is ensured by building a third stage (strap).
starr.version=2.11.7