summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2015-09-08 13:23:22 -0400
committerSeth Tisue <seth@tisue.net>2015-09-08 13:23:22 -0400
commitad17b552b8f7c3a435ad8de71cd7268f905a1b8d (patch)
treefc4093f85c79cb9dc6bfb77a62128652f32a68ec
parent468abc47999a39801f9e8672900fea797dea6611 (diff)
downloadscala-ad17b552b8f7c3a435ad8de71cd7268f905a1b8d.tar.gz
scala-ad17b552b8f7c3a435ad8de71cd7268f905a1b8d.tar.bz2
scala-ad17b552b8f7c3a435ad8de71cd7268f905a1b8d.zip
Merge remote-tracking branch 'origin/2.11.x' into 2.12.x
only trivial merge conflicts here. not dealing with PR #4333 in this merge because there is a substantial conflict there -- so that's why I stopped at 63daba33ae99471175e9d7b20792324615f5999b for now
-rw-r--r--CONTRIBUTING.md4
-rw-r--r--README.md76
-rw-r--r--docs/TODO2
-rwxr-xr-xscripts/jobs/integrate/bootstrap6
-rw-r--r--spec/01-lexical-syntax.md7
-rw-r--r--spec/05-classes-and-objects.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/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/GenASM.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.scala6
-rw-r--r--src/compiler/scala/tools/nsc/io/Jar.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Delambdafy.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala41
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala2
-rw-r--r--src/compiler/scala/tools/reflect/ReflectGlobal.scala16
-rw-r--r--src/library-aux/scala/Any.scala2
-rw-r--r--src/library/scala/AnyVal.scala2
-rw-r--r--src/library/scala/Equals.scala5
-rw-r--r--src/library/scala/Option.scala2
-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/collection/mutable/PriorityQueue.scala15
-rw-r--r--src/library/scala/concurrent/SyncVar.scala2
-rw-r--r--src/library/scala/io/Codec.scala2
-rw-r--r--src/library/scala/reflect/ClassManifestDeprecatedApis.scala4
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala2
-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/ClassfileConstants.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.scala4
-rw-r--r--src/reflect/scala/reflect/internal/transform/UnCurry.scala22
-rw-r--r--src/reflect/scala/reflect/runtime/JavaUniverseForce.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--src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.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/pos/t9442.scala14
-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
74 files changed, 392 insertions, 133 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 bdb7fcbc28..7ee3cac42b 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" ant docs
```
-ANT_OPTS = "-Xms512M -Xmx2048M -Xss1M" 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/scripts/jobs/integrate/bootstrap b/scripts/jobs/integrate/bootstrap
index 706a20daf4..b2ae195dc4 100755
--- a/scripts/jobs/integrate/bootstrap
+++ b/scripts/jobs/integrate/bootstrap
@@ -33,7 +33,7 @@
# - Set <MODULE>_VER to override the default, e.g. XML_VER="1.0.4".
# - The git revision is set to <MODULE>_REF="v$<MODULE>_VER". Make sure the tag exists (you can't override <MODULE>_REF).
#
-# - Otherwise (moduleVersioning has some other value): in this mode we use nightly version nubmers for modules.
+# - Otherwise (moduleVersioning has some other value): in this mode we use nightly version numbers for modules.
# - By default the script sets all <MODULE>_REF to "HEAD", override to build a specific revision.
# - The <MODULE>_VER is set to a nightly version, for example "1.0.3-7-g14888a2-nightly" (you can't override <MODULE>_VER)
@@ -311,7 +311,7 @@ scalaVerToBinary() {
# - the suffix starts with "-bin": 2.12.0-bin-M1
# - the patch version is > 0 : 2.12.1-M1, 1.12.3-RC2, 2.12.1-sha-nightly, 2.12.2-SNAPSHOT
#
- # Othwersise, the binary version is the full version: 2.12.0-M1, 2.12.0-RC2, 2.12.0-sha-nightly, 2.12.0-SNAPSHOT
+ # Otherwise, the binary version is the full version: 2.12.0-M1, 2.12.0-RC2, 2.12.0-sha-nightly, 2.12.0-SNAPSHOT
#
# Adapted from sbt: https://github.com/sbt/sbt/blob/0.13.8/util/cross/src/main/input_sources/CrossVersionUtil.scala#L39
#
@@ -513,7 +513,7 @@ bootstrap() {
echo "### Bootstrapping Scala using locker"
- # # TODO: close all open staging repos so that we can be reaonably sure the only open one we see after publishing below is ours
+ # # TODO: close all open staging repos so that we can be reasonably sure the only open one we see after publishing below is ours
# # the ant call will create a new one
#
# Rebuild Scala with these modules so that all binary versions are consistent.
diff --git a/spec/01-lexical-syntax.md b/spec/01-lexical-syntax.md
index 06e3a458a4..72ae6e8794 100644
--- a/spec/01-lexical-syntax.md
+++ b/spec/01-lexical-syntax.md
@@ -450,9 +450,10 @@ 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 consecutive quote characters
-only at the very end. In particular, embedded newlines
-are permitted. Unicode escapes work as everywhere else, but none
-of the [escape sequences](#escape-sequences) are interpreted.
+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
+of the escape sequences [here](#escape-sequences) are interpreted.
> ```scala
> """the present string
diff --git a/spec/05-classes-and-objects.md b/spec/05-classes-and-objects.md
index 3a70f2a137..69828ec7fe 100644
--- a/spec/05-classes-and-objects.md
+++ b/spec/05-classes-and-objects.md
@@ -631,7 +631,7 @@ class Outer {
```
Here, accesses to the method `f` can appear anywhere within
-`OuterClass`, but not outside it. Accesses to method
+`Outer`, but not outside it. Accesses to method
`g` can appear anywhere within the package
`outerpkg.innerpkg`, as would be the case for
package-private methods in Java. Finally, accesses to method
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/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 b76fb3d823..f9e6a12241 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2043,11 +2043,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
@@ -2092,7 +2092,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
@@ -2106,7 +2106,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 01eff71057..a927097b62 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 22ac8f84d4..e5eb0b79d5 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/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index 7153c09377..7883ce7ffa 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -2697,7 +2697,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
case CMPG =>
(kind: @unchecked) match {
case FLOAT => emit(Opcodes.FCMPG)
- case DOUBLE => emit(Opcodes.DCMPL) // TODO bug? why not DCMPG? http://docs.oracle.com/javase/specs/jvms/se5.0/html/Instructions2.doc3.html
+ case DOUBLE => emit(Opcodes.DCMPL) // TODO bug? why not DCMPG? http://docs.oracle.com/javase/specs/jvms/se6/html/Instructions2.doc3.html
}
}
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..6b2786c1a3 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)
@@ -705,9 +705,9 @@ class Inliner[BT <: BTypes](val btypes: BT) {
// - a method name+type
//
// execution [3]
- // - resolve the CSP, yielding the boostrap method handle, the static args and the name+type
+ // - resolve the CSP, yielding the bootstrap method handle, the static args and the name+type
// - resolution entails accessibility checking [4]
- // - execute the `invoke` method of the boostrap method handle (which is signature polymorphic, check its javadoc)
+ // - execute the `invoke` method of the bootstrap method handle (which is signature polymorphic, check its javadoc)
// - the descriptor for the call is made up from the actual arguments on the stack:
// - the first parameters are "MethodHandles.Lookup, String, MethodType", then the types of the constant arguments,
// - the return type is CallSite
diff --git a/src/compiler/scala/tools/nsc/io/Jar.scala b/src/compiler/scala/tools/nsc/io/Jar.scala
index 2967f67e9c..efb026cdff 100644
--- a/src/compiler/scala/tools/nsc/io/Jar.scala
+++ b/src/compiler/scala/tools/nsc/io/Jar.scala
@@ -154,7 +154,7 @@ object Jar {
def update(key: Attributes.Name, value: String) = attrs.put(key, value)
}
- // See http://download.java.net/jdk7/docs/api/java/nio/file/Path.html
+ // See http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html
// for some ideas.
private val ZipMagicNumber = List[Byte](80, 75, 3, 4)
private def magicNumberIsZip(f: Path) = f.isFile && (f.toFile.bytes().take(4).toList == ZipMagicNumber)
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 79776485de..82e7c76409 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -111,7 +111,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure =>
impl setInfo new LazyImplClassType(iface)
}
- /** Return the implementation class of a trait; create a new one of one does not yet exist */
+ /** Return the implementation class of a trait; create a new one if one does not yet exist */
def implClass(iface: Symbol): Symbol = {
iface.info
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index 6ecdd2b195..48eb878e2a 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/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
index ddf003bb98..33fd5d0461 100644
--- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
+++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
@@ -281,7 +281,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
val parents = addSerializable(abstractFunctionErasedType)
val funOwner = originalFunction.symbol.owner
- // TODO harmonize the naming of delamdafy anon-fun classes with those spun up by Uncurry
+ // TODO harmonize the naming of delambdafy anon-fun classes with those spun up by Uncurry
// - make `anonClass.isAnonymousClass` true.
// - use `newAnonymousClassSymbol` or push the required variations into a similar factory method
// - reinstate the assertion in `Erasure.resolveAnonymousBridgeClash`
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 79a77d7a0c..57639a94c7 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -703,9 +703,46 @@ abstract class UnCurry extends InfoTransform
// declared type and assign this to a synthetic val. Later, we'll patch
// the method body to refer to this, rather than the parameter.
val tempVal: ValDef = {
+ // SI-9442: using the "uncurry-erased" type (the one after the uncurry phase) can lead to incorrect
+ // tree transformations. For example, compiling:
+ // ```
+ // def foo(c: Ctx)(l: c.Tree): Unit = {
+ // val l2: c.Tree = l
+ // }
+ // ```
+ // Results in the following AST:
+ // ```
+ // def foo(c: Ctx, l: Ctx#Tree): Unit = {
+ // val l$1: Ctx#Tree = l.asInstanceOf[Ctx#Tree]
+ // val l2: c.Tree = l$1 // no, not really, it's not.
+ // }
+ // ```
+ // Of course, this is incorrect, since `l$1` has type `Ctx#Tree`, which is not a subtype of `c.Tree`.
+ //
+ // So what we need to do is to use the pre-uncurry type when creating `l$1`, which is `c.Tree` and is
+ // correct. Now, there are two additional problems:
+ // 1. when varargs and byname params are involved, the uncurry transformation desugares these special
+ // cases to actual typerefs, eg:
+ // ```
+ // T* ~> Seq[T] (Scala-defined varargs)
+ // T* ~> Array[T] (Java-defined varargs)
+ // =>T ~> Function0[T] (by name params)
+ // ```
+ // we use the DesugaredParameterType object (defined in scala.reflect.internal.transform.UnCurry)
+ // to redo this desugaring manually here
+ // 2. the type needs to be normalized, since `gen.mkCast` checks this (no HK here, just aliases have
+ // to be expanded before handing the type to `gen.mkAttributedCast`, which calls `gen.mkCast`)
+ val info0 =
+ enteringUncurry(p.symbol.info) match {
+ case DesugaredParameterType(desugaredTpe) =>
+ desugaredTpe
+ case tpe =>
+ tpe
+ }
+ val info = info0.normalize
val tempValName = unit freshTermName (p.name + "$")
- val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC).setInfo(p.symbol.info)
- atPos(p.pos)(ValDef(newSym, gen.mkAttributedCast(Ident(p.symbol), p.symbol.info)))
+ val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC).setInfo(info)
+ atPos(p.pos)(ValDef(newSym, gen.mkAttributedCast(Ident(p.symbol), info)))
}
Packed(newParam, tempVal)
}
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/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index a7d48ceb89..e8db8309f1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -262,7 +262,14 @@ abstract class TreeCheckers extends Analyzer {
checkedTyped(tree, mode, pt)
)
private def checkedTyped(tree: Tree, mode: Mode, pt: Type): Tree = {
- val typed = wrap(tree)(super.typed(tree, mode, pt))
+ val typed = wrap(tree)(super.typed(tree.clearType(), mode, pt))
+
+ // Vlad: super.typed returns null for package defs, why is that?
+ if (typed eq null)
+ return tree
+
+ if (typed.tpe ne null)
+ assert(!typed.tpe.isErroneous, "Tree has erroneous type: " + typed)
if (tree ne typed)
treesDiffer(tree, typed)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 8228adc20e..f26baf7d93 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3294,7 +3294,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)
@@ -4095,7 +4095,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)"
@@ -4247,7 +4247,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/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index 8d4d07759f..2811520b67 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -22,7 +22,7 @@ import Jar.isJarOrZip
/** <p>
* This module provides star expansion of '-classpath' option arguments, behaves the same as
- * java, see [http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html]
+ * java, see [[http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html]]
* </p>
*
* @author Stepan Koltsov
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/library-aux/scala/Any.scala b/src/library-aux/scala/Any.scala
index 1be186d114..8caf0c5c0e 100644
--- a/src/library-aux/scala/Any.scala
+++ b/src/library-aux/scala/Any.scala
@@ -27,7 +27,7 @@ package scala
* w.print()
* }}}
*
- * See the [[http://docs.scala-lang.org/sips/pending/value-classes.html value classes guide]] for more
+ * See the [[http://docs.scala-lang.org/sips/completed/value-classes.html value classes guide]] for more
* details on the interplay of universal traits and value classes.
*/
abstract class Any {
diff --git a/src/library/scala/AnyVal.scala b/src/library/scala/AnyVal.scala
index ff62948413..fb3d213e19 100644
--- a/src/library/scala/AnyVal.scala
+++ b/src/library/scala/AnyVal.scala
@@ -49,7 +49,7 @@ package scala
* It's important to note that user-defined value classes are limited, and in some circumstances,
* still must allocate a value class instance at runtime. These limitations and circumstances are
* explained in greater detail in the [[http://docs.scala-lang.org/overviews/core/value-classes.html Value Classes Guide]]
- * as well as in [[http://docs.scala-lang.org/sips/pending/value-classes.html SIP-15: Value Classes]],
+ * as well as in [[http://docs.scala-lang.org/sips/completed/value-classes.html SIP-15: Value Classes]],
* the Scala Improvement Proposal.
*/
abstract class AnyVal extends Any {
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/Option.scala b/src/library/scala/Option.scala
index f134f5ce3d..7282feebb6 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -270,7 +270,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
* // Returns None because the partial function doesn't cover the case.
* Some("ftp") collect {case "http" => "HTTP"}
*
- * // Returns None because None is passed to the collect method.
+ * // Returns None because the option is empty. There is no value to pass to the partial function.
* None collect {case value => value}
* }}}
*
diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala
index 6b71c0fa66..603d97c3ad 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/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index 619beeb1d6..e6889da3b5 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -18,8 +18,19 @@ import generic._
*
* Only the `dequeue` and `dequeueAll` methods will return elements in priority
* order (while removing elements from the heap). Standard collection methods
- * including `drop` and `iterator` will remove or traverse the heap in whichever
- * order seems most convenient.
+ * including `drop`, `iterator`, and `toString` will remove or traverse the heap
+ * in whichever order seems most convenient.
+ *
+ * Therefore, printing a `PriorityQueue` will not reveal the priority order of
+ * the elements, though the highest-priority element will be printed first. To
+ * print the elements in order, one must duplicate the `PriorityQueue` (by using
+ * `clone`, for instance) and then dequeue them:
+ *
+ * @example {{{
+ * val pq = collection.mutable.PriorityQueue(1, 2, 5, 3, 7)
+ * println(pq) // elements probably not in order
+ * println(pq.clone.dequeueAll) // prints Vector(7, 5, 3, 2, 1)
+ * }}}
*
* @tparam A type of the elements in this priority queue.
* @param ord implicit ordering used to compare the elements of type `A`.
diff --git a/src/library/scala/concurrent/SyncVar.scala b/src/library/scala/concurrent/SyncVar.scala
index 9634f6d900..1ee27b0f36 100644
--- a/src/library/scala/concurrent/SyncVar.scala
+++ b/src/library/scala/concurrent/SyncVar.scala
@@ -40,7 +40,7 @@ class SyncVar[A] {
wait(timeout)
val elapsed = System.nanoTime() - start
// nanoTime should be monotonic, but it's not possible to rely on that.
- // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6458294.
+ // See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6458294.
if (elapsed < 0) 0 else TimeUnit.NANOSECONDS.toMillis(elapsed)
}
diff --git a/src/library/scala/io/Codec.scala b/src/library/scala/io/Codec.scala
index 60f99199cb..2a41e25b01 100644
--- a/src/library/scala/io/Codec.scala
+++ b/src/library/scala/io/Codec.scala
@@ -22,7 +22,7 @@ import scala.language.implicitConversions
// <?xml version="1.0" encoding="ISO8859-1" ?>
//
// MacRoman vs. UTF-8: see http://jira.codehaus.org/browse/JRUBY-3576
-// -Dfile.encoding: see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4375816
+// -Dfile.encoding: see http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4375816
/** A class for character encoding/decoding preferences.
*
diff --git a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
index ca7a3cddb8..82ec872806 100644
--- a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
+++ b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
@@ -218,7 +218,7 @@ object ClassManifestFactory {
/** ClassManifest for the abstract type `prefix # name`. `upperBound` is not
* strictly necessary as it could be obtained by reflection. It was
* added so that erasure can be calculated without reflection.
- * todo: remove after next boostrap
+ * todo: remove after next bootstrap
*/
def abstractType[T](prefix: OptManifest[_], name: String, upperbound: ClassManifest[_], args: OptManifest[_]*): ClassManifest[T] =
new ClassManifest[T] {
@@ -239,4 +239,4 @@ private class ClassTypeManifest[T](
(if (prefix.isEmpty) "" else prefix.get.toString+"#") +
(if (runtimeClass.isArray) "Array" else runtimeClass.getName) +
argString
-} \ No newline at end of file
+}
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index ce27a0ce63..026d5edd29 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -155,7 +155,7 @@ object ScalaRunTime {
arr
}
- // Java bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957
+ // Java bug: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4071957
// More background at ticket #2318.
def ensureAccessible(m: JMethod): JMethod = scala.reflect.ensureAccessible(m)
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/ClassfileConstants.scala b/src/reflect/scala/reflect/internal/ClassfileConstants.scala
index e5d97e8959..a4223c1cb5 100644
--- a/src/reflect/scala/reflect/internal/ClassfileConstants.scala
+++ b/src/reflect/scala/reflect/internal/ClassfileConstants.scala
@@ -14,7 +14,7 @@ object ClassfileConstants {
final val JAVA_MAJOR_VERSION = 45
final val JAVA_MINOR_VERSION = 3
- /** (see http://java.sun.com/docs/books/jvms/second_edition/jvms-clarify.html)
+ /** (see http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1)
*
* If the `ACC_INTERFACE` flag is set, the `ACC_ABSTRACT` flag must also
* be set (ch. 2.13.1).
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 1113da2eff..05fdfb51ed 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -2124,7 +2124,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..bbd9df05d2 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -1418,7 +1418,7 @@ trait Trees extends api.Trees {
transformTypeDefs(tparams), transform(rhs))
}
case LabelDef(name, params, rhs) =>
- treeCopy.LabelDef(tree, name, transformIdents(params), transform(rhs)) //bq: Martin, once, atOwner(...) works, also change `LamdaLifter.proxy'
+ treeCopy.LabelDef(tree, name, transformIdents(params), transform(rhs)) //bq: Martin, once, atOwner(...) works, also change `LambdaLifter.proxy'
case PackageDef(pid, stats) =>
treeCopy.PackageDef(
tree, transform(pid).asInstanceOf[RefTree],
@@ -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/reflect/scala/reflect/internal/transform/UnCurry.scala b/src/reflect/scala/reflect/internal/transform/UnCurry.scala
index abea8bed9f..85e3ac60e8 100644
--- a/src/reflect/scala/reflect/internal/transform/UnCurry.scala
+++ b/src/reflect/scala/reflect/internal/transform/UnCurry.scala
@@ -40,19 +40,27 @@ trait UnCurry {
apply(MethodType(h.cloneSymbol.resetFlag(IMPLICIT) :: t, restpe))
case NullaryMethodType(restpe) =>
apply(MethodType(List(), restpe))
- case TypeRef(pre, ByNameParamClass, arg :: Nil) =>
- apply(functionType(List(), arg))
- case TypeRef(pre, RepeatedParamClass, arg :: Nil) =>
- apply(seqType(arg))
- case TypeRef(pre, JavaRepeatedParamClass, arg :: Nil) =>
- apply(arrayType(
- if (isUnboundedGeneric(arg)) ObjectTpe else arg))
+ case DesugaredParameterType(desugaredTpe) =>
+ apply(desugaredTpe)
case _ =>
expandAlias(mapOver(tp))
}
}
}
+ object DesugaredParameterType {
+ def unapply(tpe: Type): Option[Type] = tpe match {
+ case TypeRef(pre, ByNameParamClass, arg :: Nil) =>
+ Some(functionType(List(), arg))
+ case TypeRef(pre, RepeatedParamClass, arg :: Nil) =>
+ Some(seqType(arg))
+ case TypeRef(pre, JavaRepeatedParamClass, arg :: Nil) =>
+ Some(arrayType(if (isUnboundedGeneric(arg)) ObjectTpe else arg))
+ case _ =>
+ None
+ }
+ }
+
private val uncurryType = new TypeMap {
def apply(tp0: Type): Type = {
val tp = expandAlias(tp0)
diff --git a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala
index a2232d1963..278d081249 100644
--- a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala
+++ b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala
@@ -445,7 +445,7 @@ trait JavaUniverseForce { self: runtime.JavaUniverse =>
definitions.ScalaValueClassesNoUnit
definitions.ScalaValueClasses
-
+ uncurry.DesugaredParameterType
erasure.GenericArray
erasure.scalaErasure
erasure.specialScalaErasure
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 743c2a401c..0353e58e67 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
@@ -787,7 +787,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/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala
index 4bed106f43..9381cf3a35 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala
@@ -145,7 +145,7 @@ class DotProcess(settings: doc.Settings) {
// we shouldn't just sit there for 50s not reporting anything, no?
settings.printMsg("Graphviz dot encountered an error when generating the diagram for:")
settings.printMsg(templateName)
- settings.printMsg("These are usually spurious errors, but if you notice a persistant error on")
+ settings.printMsg("These are usually spurious errors, but if you notice a persistent error on")
settings.printMsg("a diagram, please use the " + settings.docDiagramsDebug.name + " flag and report a bug with the output.")
}
}
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/pos/t9442.scala b/test/files/pos/t9442.scala
new file mode 100644
index 0000000000..2ea81e79cb
--- /dev/null
+++ b/test/files/pos/t9442.scala
@@ -0,0 +1,14 @@
+trait Ctx {
+ trait Tree
+}
+trait Lst[+A] {
+ def zip[A1 >: A, B](that: Lst[B]): Nothing
+}
+class C[@specialized(Int) T] {
+ def moo(t: T) = {
+ def foo1(c: Ctx)(l: Lst[c.Tree]) = l zip l
+ def foo2(c: Ctx)(l: Lst[c.Tree]*) = l(0) zip l(1)
+ def foo3(c: Ctx)(l: => Lst[c.Tree]) = l zip l
+ ???
+ }
+}
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)
)