summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--META-INF/MANIFEST.MF51
-rw-r--r--build.sbt146
-rw-r--r--project/Osgi.scala19
-rw-r--r--project/PartestUtil.scala5
-rw-r--r--spec/05-classes-and-objects.md4
-rw-r--r--spec/06-expressions.md4
-rw-r--r--spec/README.md4
-rw-r--r--src/build/genprod.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala13
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala1
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala48
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala8
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala21
-rw-r--r--src/library/scala/Array.scala3
-rw-r--r--src/library/scala/Immutable.scala2
-rw-r--r--src/library/scala/Int.scala4
-rw-r--r--src/library/scala/Option.scala2
-rw-r--r--src/library/scala/Product1.scala2
-rw-r--r--src/library/scala/Product10.scala2
-rw-r--r--src/library/scala/Product11.scala2
-rw-r--r--src/library/scala/Product12.scala2
-rw-r--r--src/library/scala/Product13.scala2
-rw-r--r--src/library/scala/Product14.scala2
-rw-r--r--src/library/scala/Product15.scala2
-rw-r--r--src/library/scala/Product16.scala2
-rw-r--r--src/library/scala/Product17.scala2
-rw-r--r--src/library/scala/Product18.scala2
-rw-r--r--src/library/scala/Product19.scala2
-rw-r--r--src/library/scala/Product2.scala2
-rw-r--r--src/library/scala/Product20.scala2
-rw-r--r--src/library/scala/Product21.scala2
-rw-r--r--src/library/scala/Product22.scala2
-rw-r--r--src/library/scala/Product3.scala2
-rw-r--r--src/library/scala/Product4.scala2
-rw-r--r--src/library/scala/Product5.scala2
-rw-r--r--src/library/scala/Product6.scala2
-rw-r--r--src/library/scala/Product7.scala2
-rw-r--r--src/library/scala/Product8.scala2
-rw-r--r--src/library/scala/Product9.scala2
-rw-r--r--src/library/scala/collection/Iterator.scala27
-rw-r--r--src/library/scala/collection/Parallelizable.scala2
-rw-r--r--src/library/scala/collection/SetLike.scala4
-rw-r--r--src/library/scala/collection/SortedSet.scala2
-rw-r--r--src/library/scala/collection/generic/GenTraversableFactory.scala2
-rw-r--r--src/library/scala/collection/immutable/List.scala4
-rw-r--r--src/library/scala/collection/immutable/SetProxy.scala3
-rw-r--r--src/library/scala/collection/immutable/SortedSet.scala2
-rw-r--r--src/library/scala/collection/immutable/Vector.scala9
-rw-r--r--src/library/scala/collection/mutable/ArrayBuffer.scala2
-rw-r--r--src/library/scala/collection/mutable/HashTable.scala6
-rw-r--r--src/library/scala/collection/mutable/History.scala2
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala2
-rw-r--r--src/library/scala/collection/mutable/ResizableArray.scala2
-rw-r--r--src/library/scala/collection/mutable/ReusableBuilder.scala4
-rw-r--r--src/library/scala/collection/parallel/TaskSupport.scala4
-rw-r--r--src/library/scala/collection/parallel/immutable/ParRange.scala1
-rw-r--r--src/library/scala/concurrent/duration/Duration.scala14
-rw-r--r--src/library/scala/concurrent/impl/ExecutionContextImpl.scala2
-rw-r--r--src/library/scala/concurrent/impl/Promise.scala2
-rw-r--r--src/library/scala/io/Source.scala2
-rw-r--r--src/library/scala/math/BigInt.scala4
-rw-r--r--src/library/scala/reflect/ClassManifestDeprecatedApis.scala4
-rw-r--r--src/library/scala/sys/process/ProcessBuilder.scala2
-rw-r--r--src/library/scala/sys/process/package.scala4
-rw-r--r--src/library/scala/util/Either.scala2
-rw-r--r--src/manual/scala/man1/scalac.scala4
-rw-r--r--src/manual/scala/man1/scalap.scala2
-rw-r--r--src/partest-extras/scala/tools/partest/JavapTest.scala2
-rw-r--r--src/partest-extras/scala/tools/partest/ReplTest.scala2
-rw-r--r--src/reflect/scala/reflect/api/Internals.scala2
-rw-r--r--src/reflect/scala/reflect/api/StandardDefinitions.scala2
-rw-r--r--src/reflect/scala/reflect/api/Types.scala2
-rw-r--r--src/reflect/scala/reflect/internal/AnnotationInfos.scala2
-rw-r--r--src/reflect/scala/reflect/internal/BaseTypeSeqs.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Constants.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Names.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala2
-rw-r--r--src/reflect/scala/reflect/internal/TreeGen.scala2
-rw-r--r--src/reflect/scala/reflect/internal/tpe/FindMembers.scala4
-rw-r--r--src/reflect/scala/reflect/runtime/JavaUniverse.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/Phased.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/Entity.scala8
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala4
-rw-r--r--test/files/jvm/future-spec/FutureTests.scala2
-rw-r--r--test/files/jvm/serialization-new.check8
-rw-r--r--test/files/jvm/serialization.check8
-rw-r--r--test/files/pos/t6734.scala17
-rw-r--r--test/files/pos/t6978.flags1
-rw-r--r--test/files/pos/t6978/J.java5
-rw-r--r--test/files/pos/t6978/S.scala7
-rw-r--r--test/files/run/t10032.check82
-rw-r--r--test/files/run/t10032.scala164
-rw-r--r--test/files/run/t8433.check2
-rw-r--r--test/files/run/t8433.scala46
-rw-r--r--test/files/run/t9375.scala2
-rw-r--r--test/files/run/t9689.check14
-rw-r--r--test/files/run/t9689/Test_2.scala12
-rw-r--r--test/files/run/t9689/bug_1.scala8
-rw-r--r--test/files/run/t9915/C_1.java18
-rw-r--r--test/files/run/t9915/Test_2.scala12
-rw-r--r--test/junit/scala/collection/IteratorTest.scala6
-rw-r--r--test/junit/scala/collection/parallel/immutable/ParRangeTest.scala15
113 files changed, 705 insertions, 295 deletions
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
deleted file mode 100644
index 4ee2d086ac..0000000000
--- a/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,51 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Scala Distribution
-Bundle-SymbolicName: org.scala-ide.scala.compiler;singleton:=true
-Bundle-Version: 2.10.0.alpha
-Eclipse-LazyStart: true
-Bundle-ClassPath:
- .,
- bin,
- lib/jline.jar,
-Export-Package:
- scala.tools.nsc,
- scala.tools.nsc.ast,
- scala.tools.nsc.ast.parser,
- scala.tools.nsc.backend,
- scala.tools.nsc.backend.icode,
- scala.tools.nsc.backend.icode.analysis,
- scala.tools.nsc.backend.jvm,
- scala.tools.nsc.backend.opt,
- scala.tools.nsc.dependencies,
- scala.tools.nsc.doc,
- scala.tools.nsc.doc.html,
- scala.tools.nsc.doc.html.page,
- scala.tools.nsc.doc.model,
- scala.tools.nsc.doc.model.comment,
- scala.tools.nsc.interactive,
- scala.tools.nsc.interpreter,
- scala.tools.nsc.io,
- scala.tools.nsc.javac,
- scala.tools.nsc.matching,
- scala.tools.nsc.plugins,
- scala.tools.nsc.reporters,
- scala.tools.nsc.settings,
- scala.tools.nsc.symtab,
- scala.tools.nsc.symtab.classfile,
- scala.tools.nsc.transform,
- scala.tools.nsc.typechecker,
- scala.tools.nsc.util,
- scala.tools.util,
- scala.reflect.internal,
- scala.reflect.internal.pickling,
- scala.reflect.internal.settings,
- scala.reflect.internal.util,
- scala.reflect.macros,
- scala.reflect.runtime,
- scala.reflect.internal.transform,
- scala.reflect.api,
-Require-Bundle:
- org.apache.ant,
- org.scala-ide.scala.library
-
diff --git a/build.sbt b/build.sbt
index e88e35da02..1337a350ac 100644
--- a/build.sbt
+++ b/build.sbt
@@ -91,6 +91,8 @@ baseVersion in Global := "2.12.1"
baseVersionSuffix in Global := "SNAPSHOT"
mimaReferenceVersion in Global := Some("2.12.0-RC1")
+scalaVersion in Global := versionProps("starr.version")
+
lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings ++ Seq[Setting[_]](
organization := "org.scala-lang",
// we don't cross build Scala itself
@@ -104,12 +106,15 @@ lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings +
// sbt claims that s.isManagedVersion is false even though s was resolved by Ivy
// We create a managed copy to prevent sbt from putting it on the classpath where we don't want it
if(s.isManagedVersion) s else {
- val s2 = new ScalaInstance(s.version, s.loader, s.libraryJar, s.compilerJar, s.extraJars, Some(s.actualVersion))
+ val jars = s.jars
+ val libraryJar = jars.find(_.getName contains "-library").get
+ val compilerJar = jars.find(_.getName contains "-compiler").get
+ val extraJars = jars.filter(f => (f ne libraryJar) && (f ne compilerJar))
+ val s2 = new ScalaInstance(s.version, s.loader, libraryJar, compilerJar, extraJars, Some(s.actualVersion))
assert(s2.isManagedVersion)
s2
}
},
- scalaVersion := (scalaVersion in bootstrap).value,
// As of sbt 0.13.12 (sbt/sbt#2634) sbt endeavours to align both scalaOrganization and scalaVersion
// in the Scala artefacts, for example scala-library and scala-compiler.
// This doesn't work in the scala/scala build because the version of scala-library and the scalaVersion of
@@ -147,7 +152,7 @@ lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings +
"-sourcepath", (baseDirectory in ThisBuild).value.toString,
"-doc-source-url", s"https://github.com/scala/scala/tree/${versionProperties.value.githubTree}€{FILE_PATH}.scala#L1"
),
- incOptions <<= (incOptions in LocalProject("root")),
+ incOptions := (incOptions in LocalProject("root")).value,
homepage := Some(url("http://www.scala-lang.org")),
startYear := Some(2002),
licenses += (("BSD 3-Clause", url("http://www.scala-lang.org/license.html"))),
@@ -304,7 +309,7 @@ def filterDocSources(ff: FileFilter): Seq[Setting[_]] = Seq(
// binaries of the library on the classpath. Specifically, we get this error:
// (library/compile:doc) scala.reflect.internal.FatalError: package class scala does not have a member Int
dependencyClasspath in (Compile, doc) += (classDirectory in Compile).value,
- doc in Compile <<= doc in Compile dependsOn (compile in Compile)
+ doc in Compile := (doc in Compile).dependsOn(compile in Compile).value
)
def regexFileFilter(s: String): FileFilter = new FileFilter {
@@ -313,13 +318,11 @@ def regexFileFilter(s: String): FileFilter = new FileFilter {
}
// This project provides the STARR scalaInstance for bootstrapping
-lazy val bootstrap = (project in file("target/bootstrap")).settings(
- scalaVersion := versionProps("starr.version")
-)
+lazy val bootstrap = project in file("target/bootstrap")
lazy val library = configureAsSubproject(project)
- .settings(generatePropertiesFileSettings: _*)
- .settings(Osgi.settings: _*)
+ .settings(generatePropertiesFileSettings)
+ .settings(Osgi.settings)
.settings(
name := "scala-library",
description := "Scala Standard Library",
@@ -333,6 +336,8 @@ lazy val library = configureAsSubproject(project)
"-doc-root-content", (sourceDirectory in Compile).value + "/rootdoc.txt"
)
},
+ // macros in library+reflect are hard-wired to implementations with `FastTrack`.
+ incOptions := incOptions.value.withRecompileOnMacroDef(false),
includeFilter in unmanagedResources in Compile := "*.tmpl" | "*.xml" | "*.js" | "*.css" | "rootdoc.txt",
// Include *.txt files in source JAR:
mappings in Compile in packageSrc ++= {
@@ -351,15 +356,17 @@ lazy val library = configureAsSubproject(project)
)
.settings(filterDocSources("*.scala" -- (regexFileFilter(".*/runtime/.*\\$\\.scala") ||
regexFileFilter(".*/runtime/ScalaRunTime\\.scala") ||
- regexFileFilter(".*/runtime/StringAdd\\.scala"))): _*)
- .settings(MiMa.settings: _*)
+ regexFileFilter(".*/runtime/StringAdd\\.scala"))))
+ .settings(MiMa.settings)
lazy val reflect = configureAsSubproject(project)
- .settings(generatePropertiesFileSettings: _*)
- .settings(Osgi.settings: _*)
+ .settings(generatePropertiesFileSettings)
+ .settings(Osgi.settings)
.settings(
name := "scala-reflect",
description := "Scala Reflection Library",
+ // macros in library+reflect are hard-wired to implementations with `FastTrack`.
+ incOptions := incOptions.value.withRecompileOnMacroDef(false),
Osgi.bundleName := "Scala Reflect",
scalacOptions in Compile in doc ++= Seq(
"-skip-packages", "scala.reflect.macros.internal:scala.reflect.internal:scala.reflect.io"
@@ -374,13 +381,13 @@ lazy val reflect = configureAsSubproject(project)
"/project/packaging" -> <packaging>jar</packaging>
)
)
- .settings(MiMa.settings: _*)
+ .settings(MiMa.settings)
.dependsOn(library)
lazy val compiler = configureAsSubproject(project)
- .settings(generatePropertiesFileSettings: _*)
- .settings(generateBuildCharacterFileSettings: _*)
- .settings(Osgi.settings: _*)
+ .settings(generatePropertiesFileSettings)
+ .settings(generateBuildCharacterFileSettings)
+ .settings(Osgi.settings)
.settings(
name := "scala-compiler",
description := "Scala Compiler",
@@ -447,8 +454,8 @@ lazy val compiler = configureAsSubproject(project)
.dependsOn(library, reflect)
lazy val interactive = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
name := "scala-compiler-interactive",
description := "Scala Interactive Compiler"
@@ -456,17 +463,17 @@ lazy val interactive = configureAsSubproject(project)
.dependsOn(compiler)
lazy val repl = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
connectInput in run := true,
- run <<= (run in Compile).partialInput(" -usejavacp") // Automatically add this so that `repl/run` works without additional arguments.
+ run := (run in Compile).partialInput(" -usejavacp").evaluated // Automatically add this so that `repl/run` works without additional arguments.
)
.dependsOn(compiler, interactive)
lazy val replJline = configureAsSubproject(Project("repl-jline", file(".") / "src" / "repl-jline"))
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
libraryDependencies += jlineDep,
name := "scala-repl-jline"
@@ -474,8 +481,8 @@ lazy val replJline = configureAsSubproject(Project("repl-jline", file(".") / "sr
.dependsOn(repl)
lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target" / "repl-jline-embedded-src-dummy")
- .settings(scalaSubprojectSettings: _*)
- .settings(disablePublishing: _*)
+ .settings(scalaSubprojectSettings)
+ .settings(disablePublishing)
.settings(
name := "scala-repl-jline-embedded",
// There is nothing to compile for this project. Instead we use the compile task to create
@@ -483,7 +490,7 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target"
// quick/repl-jline and quick/repl-jline-shaded on the classpath for quick/bin scripts.
// This is different from the Ant build where all parts are combined into quick/repl, but
// it is cleaner because it avoids circular dependencies.
- compile in Compile <<= (compile in Compile).dependsOn(Def.task {
+ compile in Compile := (compile in Compile).dependsOn(Def.task {
import java.util.jar._
import collection.JavaConverters._
val inputs: Iterator[JarJar.Entry] = {
@@ -505,15 +512,15 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target"
)
val outdir = (classDirectory in Compile).value
JarJar(inputs, outdir, config)
- }),
+ }).value,
connectInput in run := true
)
.dependsOn(replJline)
lazy val scaladoc = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
name := "scala-compiler-doc",
description := "Scala Documentation Generator",
@@ -537,11 +544,11 @@ lazy val scalap = configureAsSubproject(project)
lazy val partestExtras = Project("partest-extras", file(".") / "src" / "partest-extras")
.dependsOn(replJlineEmbedded)
- .settings(commonSettings: _*)
- .settings(generatePropertiesFileSettings: _*)
- .settings(clearSourceAndResourceDirectories: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(commonSettings)
+ .settings(generatePropertiesFileSettings)
+ .settings(clearSourceAndResourceDirectories)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
name := "scala-partest-extras",
description := "Scala Compiler Testing Tool (compiler-specific extras)",
@@ -551,10 +558,10 @@ lazy val partestExtras = Project("partest-extras", file(".") / "src" / "partest-
lazy val junit = project.in(file("test") / "junit")
.dependsOn(library, reflect, compiler, partestExtras, scaladoc)
- .settings(clearSourceAndResourceDirectories: _*)
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(clearSourceAndResourceDirectories)
+ .settings(commonSettings)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
fork in Test := true,
javaOptions in Test += "-Xss1M",
@@ -574,10 +581,10 @@ lazy val osgiTestEclipse = osgiTestProject(
def osgiTestProject(p: Project, framework: ModuleID) = p
.dependsOn(library, reflect, compiler)
- .settings(clearSourceAndResourceDirectories: _*)
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(clearSourceAndResourceDirectories)
+ .settings(commonSettings)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
fork in Test := true,
parallelExecution in Test := false,
@@ -597,7 +604,7 @@ def osgiTestProject(p: Project, framework: ModuleID) = p
framework % "test"
)
},
- Keys.test in Test <<= Keys.test in Test dependsOn (packageBin in Compile),
+ Keys.test in Test := (Keys.test in Test).dependsOn(packageBin in Compile).value,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v", "-q"),
unmanagedSourceDirectories in Test := List((baseDirectory in ThisBuild).value / "test" / "osgi" / "src"),
unmanagedResourceDirectories in Compile := (unmanagedSourceDirectories in Test).value,
@@ -614,9 +621,9 @@ def osgiTestProject(p: Project, framework: ModuleID) = p
)
lazy val partestJavaAgent = Project("partest-javaagent", file(".") / "src" / "partest-javaagent")
- .settings(commonSettings: _*)
- .settings(generatePropertiesFileSettings: _*)
- .settings(disableDocs: _*)
+ .settings(commonSettings)
+ .settings(generatePropertiesFileSettings)
+ .settings(disableDocs)
.settings(
libraryDependencies += asmDep,
publishLocal := {},
@@ -634,10 +641,10 @@ lazy val partestJavaAgent = Project("partest-javaagent", file(".") / "src" / "pa
lazy val test = project
.dependsOn(compiler, interactive, replJlineEmbedded, scalap, partestExtras, partestJavaAgent, scaladoc)
.configs(IntegrationTest)
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
- .settings(Defaults.itSettings: _*)
+ .settings(commonSettings)
+ .settings(disableDocs)
+ .settings(disablePublishing)
+ .settings(Defaults.itSettings)
.settings(
libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, scalacheckDep),
libraryDependencies ++= {
@@ -688,16 +695,16 @@ lazy val test = project
)
lazy val manual = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
libraryDependencies ++= Seq(scalaXmlDep, antDep, "org.scala-lang" % "scala-library" % scalaVersion.value),
classDirectory in Compile := (target in Compile).value / "classes"
)
lazy val libraryAll = Project("library-all", file(".") / "target" / "library-all-src-dummy")
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
+ .settings(commonSettings)
+ .settings(disableDocs)
.settings(
name := "scala-library-all",
publishArtifact in (Compile, packageBin) := false,
@@ -712,8 +719,8 @@ lazy val libraryAll = Project("library-all", file(".") / "target" / "library-all
.dependsOn(library, reflect)
lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-dist-src-dummy")
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
+ .settings(commonSettings)
+ .settings(disableDocs)
.settings(
mappings in Compile in packageBin ++= {
val binBaseDir = buildDirectory.value / "pack"
@@ -758,15 +765,13 @@ lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-di
.dependsOn(libraryAll, compiler, scalap)
lazy val root: Project = (project in file("."))
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
- .settings(generateBuildCharacterFileSettings: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
+ .settings(generateBuildCharacterFileSettings)
.settings(
- publish := {},
- publishLocal := {},
commands ++= ScriptCommands.all,
extractBuildCharacterPropertiesFile := {
- val jar = (scalaInstance in bootstrap).value.compilerJar
+ val jar = (scalaInstance in bootstrap).value.allJars.find(_.getName contains "-compiler").get
val bc = buildCharacterPropertiesFile.value
val packagedName = "scala-buildcharacter.properties"
IO.withTemporaryDirectory { tmp =>
@@ -878,15 +883,15 @@ lazy val dist = (project in file("dist"))
.settings(
libraryDependencies ++= Seq(scalaSwingDep, jlineDep),
mkBin := mkBinImpl.value,
- mkQuick <<= Def.task {
+ mkQuick := Def.task {
val cp = (fullClasspath in IntegrationTest in LocalProject("test")).value
val propsFile = (buildDirectory in ThisBuild).value / "quick" / "partest.properties"
val props = new java.util.Properties()
props.setProperty("partest.classpath", cp.map(_.data.getAbsolutePath).mkString(sys.props("path.separator")))
IO.write(props, null, propsFile)
(buildDirectory in ThisBuild).value / "quick"
- } dependsOn ((distDependencies.map(products in Runtime in _) :+ mkBin): _*),
- mkPack <<= Def.task { (buildDirectory in ThisBuild).value / "pack" } dependsOn (packagedArtifact in (Compile, packageBin), mkBin),
+ }.dependsOn((distDependencies.map(products in Runtime in _) :+ mkBin): _*).value,
+ mkPack := Def.task { (buildDirectory in ThisBuild).value / "pack" }.dependsOn(packagedArtifact in (Compile, packageBin), mkBin).value,
target := (baseDirectory in ThisBuild).value / "target" / thisProject.value.id,
packageBin in Compile := {
val extraDeps = Set(scalaSwingDep, scalaParserCombinatorsDep, scalaXmlDep)
@@ -903,7 +908,10 @@ lazy val dist = (project in file("dist"))
},
cleanFiles += (buildDirectory in ThisBuild).value / "quick",
cleanFiles += (buildDirectory in ThisBuild).value / "pack",
- packagedArtifact in (Compile, packageBin) <<= (packagedArtifact in (Compile, packageBin)).dependsOn(distDependencies.map(packagedArtifact in (Compile, packageBin) in _): _*)
+ packagedArtifact in (Compile, packageBin) :=
+ (packagedArtifact in (Compile, packageBin))
+ .dependsOn(distDependencies.map(packagedArtifact in (Compile, packageBin) in _): _*)
+ .value
)
.dependsOn(distDependencies.map(p => p: ClasspathDep[ProjectReference]): _*)
@@ -921,8 +929,8 @@ lazy val dist = (project in file("dist"))
def configureAsSubproject(project: Project): Project = {
val base = file(".") / "src" / project.id
(project in base)
- .settings(scalaSubprojectSettings: _*)
- .settings(generatePropertiesFileSettings: _*)
+ .settings(scalaSubprojectSettings)
+ .settings(generatePropertiesFileSettings)
}
lazy val buildDirectory = settingKey[File]("The directory where all build products go. By default ./build")
diff --git a/project/Osgi.scala b/project/Osgi.scala
index 8a62c9128a..082fd91ed1 100644
--- a/project/Osgi.scala
+++ b/project/Osgi.scala
@@ -36,12 +36,12 @@ object Osgi {
)
},
jarlist := false,
- bundle <<= Def.task {
- val res = (products in Compile in packageBin).value
- bundleTask(headers.value.toMap, jarlist.value, (products in Compile in packageBin).value,
- (artifactPath in (Compile, packageBin)).value, res, streams.value)
- },
- packagedArtifact in (Compile, packageBin) <<= (artifact in (Compile, packageBin), bundle).identityMap,
+ bundle := Def.task {
+ val cp = (products in Compile in packageBin).value
+ bundleTask(headers.value.toMap, jarlist.value, cp,
+ (artifactPath in (Compile, packageBin)).value, cp, streams.value)
+ }.value,
+ packagedArtifact in (Compile, packageBin) := (((artifact in (Compile, packageBin)).value, bundle.value)),
// Also create OSGi source bundles:
packageOptions in (Compile, packageSrc) += Package.ManifestAttributes(
"Bundle-Name" -> (description.value + " Sources"),
@@ -57,7 +57,12 @@ object Osgi {
val builder = new Builder
builder.setClasspath(fullClasspath.toArray)
headers foreach { case (k, v) => builder.setProperty(k, v) }
- val includeRes = resourceDirectories.filter(_.exists).map(_.getAbsolutePath).mkString(",")
+
+ // https://github.com/scala/scala-dev/issues/254
+ // Must be careful not to include scala-asm.jar within scala-compiler.jar!
+ def resourceDirectoryRef(f: File) = (if (f.isDirectory) "" else "@") + f.getAbsolutePath
+
+ val includeRes = resourceDirectories.filter(_.exists).map(resourceDirectoryRef).mkString(",")
if(!includeRes.isEmpty) builder.setProperty(INCLUDERESOURCE, includeRes)
builder.getProperties.asScala.foreach { case (k, v) => log.debug(s"bnd: $k: $v") }
// builder.build is not thread-safe because it uses a static SimpleDateFormat. This ensures
diff --git a/project/PartestUtil.scala b/project/PartestUtil.scala
index 99b978515c..897881d2b6 100644
--- a/project/PartestUtil.scala
+++ b/project/PartestUtil.scala
@@ -86,7 +86,10 @@ object PartestUtil {
srcPath = path
opt + " " + path
}
- val P = oneOf(knownUnaryOptions.map(x => token(x))) | SrcPath | TestPathParser | Grep
+
+ val ScalacOptsParser = (token("-Dpartest.scalac_opts=") ~ token(NotSpace)) map { case opt ~ v => opt + v }
+
+ val P = oneOf(knownUnaryOptions.map(x => token(x))) | SrcPath | TestPathParser | Grep | ScalacOptsParser
(Space ~> repsep(P, oneOrMore(Space))).map(_.mkString(" ")).?.map(_.getOrElse("")) <~ OptSpace
}
}
diff --git a/spec/05-classes-and-objects.md b/spec/05-classes-and-objects.md
index 739fd28eb1..1b9702286c 100644
--- a/spec/05-classes-and-objects.md
+++ b/spec/05-classes-and-objects.md
@@ -1103,8 +1103,8 @@ Note that the value defined by an object definition is instantiated
lazily. The `new $m$\$cls` constructor is evaluated
not at the point of the object definition, but is instead evaluated
the first time $m$ is dereferenced during execution of the program
-(which might be never at all). An attempt to dereference $m$ again in
-the course of evaluation of the constructor leads to a infinite loop
+(which might be never at all). An attempt to dereference $m$ again
+during evaluation of the constructor will lead to an infinite loop
or run-time error.
Other threads trying to dereference $m$ while the
constructor is being evaluated block until evaluation is complete.
diff --git a/spec/06-expressions.md b/spec/06-expressions.md
index 30fd94c1a8..36cd3fd3cf 100644
--- a/spec/06-expressions.md
+++ b/spec/06-expressions.md
@@ -655,7 +655,7 @@ precedence, with characters on the same line having the same precedence.
```
That is, operators starting with a letter have lowest precedence,
-followed by operators starting with ``|`', etc.
+followed by operators starting with ‘`|`’, etc.
There's one exception to this rule, which concerns
[_assignment operators_](#assignment-operators).
@@ -664,7 +664,7 @@ of simple assignment `(=)`. That is, it is lower than the
precedence of any other operator.
The _associativity_ of an operator is determined by the operator's
-last character. Operators ending in a colon ``:`' are
+last character. Operators ending in a colon ‘`:`’ are
right-associative. All other operators are left-associative.
Precedence and associativity of operators determine the grouping of
diff --git a/spec/README.md b/spec/README.md
index 9fd7c9f6ae..b19ce6441f 100644
--- a/spec/README.md
+++ b/spec/README.md
@@ -36,5 +36,5 @@ and open http://0.0.0.0:4000/. Jekyll will rebuild as you edit the markdown, but
### Unicode Character replacements
-- The unicode left and right single quotation marks (‘ and ’) have been used in place of ` and ', where the quotation marks are intended to be paired. These can be typed on a mac using Option+] for a left quote and Option+Shift+] for the right quote.
-- Similarly for left and right double quotation marks (“ and ”) in place of ". These can be typed on a mac using Option+[ and Option+Shift+].
+- The unicode left and right single quotation marks (‘ and ’ (U+2018 and U+2019, respectively)) have been used in place of ` and ', where the quotation marks are intended to be paired. These can be typed on a mac using Option+] for a left quote and Option+Shift+] for the right quote.
+- Similarly for left and right double quotation marks (“ and ” (U+201C and U+201D, respectively)) in place of ". These can be typed on a mac using Option+[ and Option+Shift+].
diff --git a/src/build/genprod.scala b/src/build/genprod.scala
index 74adb6237e..a45dc752cc 100644
--- a/src/build/genprod.scala
+++ b/src/build/genprod.scala
@@ -380,7 +380,7 @@ object {className} {{
Some(x)
}}
-/** {className} is a cartesian product of {i} component{s}.
+/** {className} is a Cartesian product of {i} component{s}.
* @since 2.3
*/
trait {className}{covariantArgs} extends Any with Product {{
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 64ed687c07..a7880c72d7 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -1297,7 +1297,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
/** does this run compile given class, module, or case factory? */
// NOTE: Early initialized members temporarily typechecked before the enclosing class, see typedPrimaryConstrBody!
- // Here we work around that wrinkle by claiming that a early-initialized member is compiled in
+ // Here we work around that wrinkle by claiming that a pre-initialized member is compiled in
// *every* run. This approximation works because this method is exclusively called with `this` == `currentRun`.
def compiles(sym: Symbol): Boolean =
if (sym == NoSymbol) false
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index 0b07e12917..b0815b0008 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -488,16 +488,11 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
bc emitRETURN returnType
case nextCleanup :: rest =>
if (saveReturnValue) {
- if (insideCleanupBlock) {
- reporter.warning(r.pos, "Return statement found in finally-clause, discarding its return-value in favor of that of a more deeply nested return.")
- bc drop returnType
- } else {
- // regarding return value, the protocol is: in place of a `return-stmt`, a sequence of `adapt, store, jump` are inserted.
- if (earlyReturnVar == null) {
- earlyReturnVar = locals.makeLocal(returnType, "earlyReturnVar")
- }
- locals.store(earlyReturnVar)
+ // regarding return value, the protocol is: in place of a `return-stmt`, a sequence of `adapt, store, jump` are inserted.
+ if (earlyReturnVar == null) {
+ earlyReturnVar = locals.makeLocal(returnType, "earlyReturnVar")
}
+ locals.store(earlyReturnVar)
}
bc goTo nextCleanup
shouldEmitCleanup = true
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
index dbad37cd5b..fdb5687311 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
@@ -255,7 +255,6 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
// used by genLoadTry() and genSynchronized()
var earlyReturnVar: Symbol = null
var shouldEmitCleanup = false
- var insideCleanupBlock = false
// line numbers
var lastEmittedLineNr = -1
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
index 466793010f..add2c5ffe6 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
@@ -36,7 +36,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
// if the synchronized block returns a result, store it in a local variable.
// Just leaving it on the stack is not valid in MSIL (stack is cleaned when leaving try-blocks).
val hasResult = (expectedType != UNIT)
- val monitorResult: Symbol = if (hasResult) locals.makeLocal(tpeTK(args.head), "monitorResult") else null;
+ val monitorResult: Symbol = if (hasResult) locals.makeLocal(tpeTK(args.head), "monitorResult") else null
/* ------ (1) pushing and entering the monitor, also keeping a reference to it in a local var. ------ */
genLoadQualifier(fun)
@@ -215,7 +215,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
* please notice `tmp` has type tree.tpe, while `earlyReturnVar` has the method return type.
* Because those two types can be different, dedicated vars are needed.
*/
- val tmp = if (guardResult) locals.makeLocal(tpeTK(tree), "tmp") else null;
+ val tmp = if (guardResult) locals.makeLocal(tpeTK(tree), "tmp") else null
/*
* upon early return from the try-body or one of its EHs (but not the EH-version of the finally-clause)
@@ -238,6 +238,34 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
val endTryBody = currProgramPoint()
bc goTo postHandlers
+ /**
+ * A return within a `try` or `catch` block where a `finally` is present ("early return")
+ * emits a store of the result to a local, jump to a "cleanup" version of the `finally` block,
+ * and sets `shouldEmitCleanup = true` (see [[PlainBodyBuilder.genReturn]]).
+ *
+ * If the try-catch is nested, outer `finally` blocks need to be emitted in a cleanup version
+ * as well, so the `shouldEmitCleanup` variable remains `true` until the outermost `finally`.
+ * Nested cleanup `finally` blocks jump to the next enclosing one. For the outermost, we emit
+ * a read of the local variable, a return, and we set `shouldEmitCleanup = false` (see
+ * [[pendingCleanups]]).
+ *
+ * Now, assume we have
+ *
+ * try { return 1 } finally {
+ * try { println() } finally { println() }
+ * }
+ *
+ * Here, the outer `finally` needs a cleanup version, but the inner one does not. The method
+ * here makes sure that `shouldEmitCleanup` is only propagated outwards, not inwards to
+ * nested `finally` blocks.
+ */
+ def withFreshCleanupScope(body: => Unit) = {
+ val savedShouldEmitCleanup = shouldEmitCleanup
+ shouldEmitCleanup = false
+ body
+ shouldEmitCleanup = savedShouldEmitCleanup || shouldEmitCleanup
+ }
+
/* ------ (2) One EH for each case-clause (this does not include the EH-version of the finally-clause)
* An EH in (2) is reached upon abrupt termination of (1).
* An EH in (2) is protected by:
@@ -246,8 +274,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
* ------
*/
- for (ch <- caseHandlers) {
-
+ for (ch <- caseHandlers) withFreshCleanupScope {
// (2.a) emit case clause proper
val startHandler = currProgramPoint()
var endHandler: asm.Label = null
@@ -277,9 +304,13 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
protect(startTryBody, endTryBody, startHandler, excType)
// (2.c) emit jump to the program point where the finally-clause-for-normal-exit starts, or in effect `after` if no finally-clause was given.
bc goTo postHandlers
-
}
+ // Need to save the state of `shouldEmitCleanup` at this point: while emitting the first
+ // version of the `finally` block below, the variable may become true. But this does not mean
+ // that we need a cleanup version for the current block, only for the enclosing ones.
+ val currentFinallyBlockNeedsCleanup = shouldEmitCleanup
+
/* ------ (3.A) The exception-handler-version of the finally-clause.
* Reached upon abrupt termination of (1) or one of the EHs in (2).
* Protected only by whatever protects the whole try-catch-finally expression.
@@ -288,7 +319,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
// a note on terminology: this is not "postHandlers", despite appearances.
// "postHandlers" as in the source-code view. And from that perspective, both (3.A) and (3.B) are invisible implementation artifacts.
- if (hasFinally) {
+ if (hasFinally) withFreshCleanupScope {
nopIfNeeded(startTryBody)
val finalHandler = currProgramPoint() // version of the finally-clause reached via unhandled exception.
protect(startTryBody, finalHandler, finalHandler, null)
@@ -316,14 +347,11 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
// this is not "postHandlers" either.
// `shouldEmitCleanup` can be set, and at the same time this try expression may lack a finally-clause.
// In other words, all combinations of (hasFinally, shouldEmitCleanup) are valid.
- if (hasFinally && shouldEmitCleanup) {
- val savedInsideCleanup = insideCleanupBlock
- insideCleanupBlock = true
+ if (hasFinally && currentFinallyBlockNeedsCleanup) {
markProgramPoint(finCleanup)
// regarding return value, the protocol is: in place of a `return-stmt`, a sequence of `adapt, store, jump` are inserted.
emitFinalizer(finalizer, null, isDuplicate = true)
pendingCleanups()
- insideCleanupBlock = savedInsideCleanup
}
/* ------ (4) finally-clause-for-normal-nonEarlyReturn-exit
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
index 5ce7072c60..16ed9da0e4 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
@@ -157,7 +157,7 @@ object InlineInfoAttribute {
}
/**
- * In order to instruct the ASM framework to de-serialize the ScalaInlineInfo attribute, we need
+ * In order to instruct the ASM framework to deserialize the ScalaInlineInfo attribute, we need
* to pass a prototype instance when running the class reader.
*/
object InlineInfoAttributePrototype extends InlineInfoAttribute(InlineInfo(false, null, null, null))
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 7e81fad606..1a4671e15f 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -8,7 +8,7 @@ package tools.nsc
package symtab
package classfile
-import java.io.{File, IOException}
+import java.io.{ByteArrayInputStream, DataInputStream, File, IOException}
import java.lang.Integer.toHexString
import scala.collection.{immutable, mutable}
@@ -212,10 +212,14 @@ abstract class ClassfileParser {
case name: Name => name
case _ =>
val start = firstExpecting(index, CONSTANT_UTF8)
- recordAtIndex(newTermName(in.buf, start + 2, in.getChar(start).toInt), index)
+ val len = in.getChar(start).toInt
+ recordAtIndex(TermName(fromMUTF8(in.buf, start, len + 2)), index)
}
)
+ private def fromMUTF8(bytes: Array[Byte], offset: Int, len: Int): String =
+ new DataInputStream(new ByteArrayInputStream(bytes, offset, len)).readUTF
+
/** Return the name found at given index in the constant pool, with '/' replaced by '.'. */
def getExternalName(index: Int): Name = {
if (index <= 0 || len <= index)
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 56d11d85a6..de0db51b6c 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -64,7 +64,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL with AccessorSynthes
// --------- helper functions -----------------------------------------------
/** A member of a trait is implemented statically if its implementation after the
- * mixin transform is RHS of the method body (destined to be in a interface default method)
+ * mixin transform is RHS of the method body (destined to be in an interface default method)
*
* To be statically implemented, a member must be a method that belonged to the trait's implementation class
* before (i.e. it is not abstract). Not statically implemented are
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
index ec493b9507..b6978f37df 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
@@ -736,7 +736,7 @@ trait MatchAnalysis extends MatchApproximation {
if (expanded.isEmpty) {
List(varAssignment)
} else {
- // we need the cartesian product here,
+ // we need the Cartesian product here,
// since we want to report all missing cases
// (i.e., combinations)
val cartesianProd = expanded.reduceLeft((xs, ys) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 0cd547c1eb..78e8c8c073 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -142,7 +142,7 @@ trait Namers extends MethodSynthesis {
val ownerHasEnumFlag =
// Necessary to check because scalac puts Java's static members into the companion object
// while Scala's enum constants live directly in the class.
- // We don't check for clazz.superClass == JavaEnumClass, because this causes a illegal
+ // We don't check for clazz.superClass == JavaEnumClass, because this causes an illegal
// cyclic reference error. See the commit message for details.
if (context.unit.isJava) owner.companionClass.hasJavaEnumFlag else owner.hasJavaEnumFlag
vd.mods.hasAllFlags(JAVA_ENUM | STABLE | STATIC) && ownerHasEnumFlag
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 106b076eef..116c932365 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -472,7 +472,7 @@ abstract class RefChecks extends Transform {
checkOverrideTypes()
checkOverrideDeprecated()
if (settings.warnNullaryOverride) {
- if (other.paramss.isEmpty && !member.paramss.isEmpty) {
+ if (other.paramss.isEmpty && !member.paramss.isEmpty && !member.isJavaDefined) {
reporter.warning(member.pos, "non-nullary method overrides nullary method")
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 7d48c548a1..cca6f280e3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3139,10 +3139,25 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
val initElems = scope.elems
// SI-5877 The decls of a package include decls of the package object. But we don't want to add
// the corresponding synthetics to the package class, only to the package object class.
- def shouldAdd(sym: Symbol) =
- inBlock || !context.isInPackageObject(sym, context.owner)
+ // SI-6734 Locality test below is meaningless if we're not even in the correct tree.
+ // For modules that are synthetic case companions, check that case class is defined here.
+ def shouldAdd(sym: Symbol): Boolean = {
+ def shouldAddAsModule: Boolean =
+ sym.moduleClass.attachments.get[ClassForCaseCompanionAttachment] match {
+ case Some(att) =>
+ val cdef = att.caseClass
+ stats.exists {
+ case t @ ClassDef(_, _, _, _) => t.symbol == cdef.symbol // cdef ne t
+ case _ => false
+ }
+ case _ => true
+ }
+
+ (!sym.isModule || shouldAddAsModule) && (inBlock || !context.isInPackageObject(sym, context.owner))
+ }
for (sym <- scope)
- for (tree <- context.unit.synthetics get sym if shouldAdd(sym)) { // OPT: shouldAdd is usually true. Call it here, rather than in the outer loop
+ // OPT: shouldAdd is usually true. Call it here, rather than in the outer loop
+ for (tree <- context.unit.synthetics.get(sym) if shouldAdd(sym)) {
newStats += typedStat(tree) // might add even more synthetics to the scope
context.unit.synthetics -= sym
}
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 6d829a9e5d..5d1c25732c 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -11,7 +11,6 @@ package scala
import scala.collection.generic._
import scala.collection.{ mutable, immutable }
import mutable.{ ArrayBuilder, ArraySeq }
-import scala.compat.Platform.arraycopy
import scala.reflect.ClassTag
import scala.runtime.ScalaRunTime.{ array_apply, array_update }
@@ -102,7 +101,7 @@ object Array extends FallbackArrayBuilding {
def copy(src: AnyRef, srcPos: Int, dest: AnyRef, destPos: Int, length: Int) {
val srcClass = src.getClass
if (srcClass.isArray && dest.getClass.isAssignableFrom(srcClass))
- arraycopy(src, srcPos, dest, destPos, length)
+ java.lang.System.arraycopy(src, srcPos, dest, destPos, length)
else
slowcopy(src, srcPos, dest, destPos, length)
}
diff --git a/src/library/scala/Immutable.scala b/src/library/scala/Immutable.scala
index fead590ef6..c7e96a46a0 100644
--- a/src/library/scala/Immutable.scala
+++ b/src/library/scala/Immutable.scala
@@ -10,7 +10,7 @@
package scala
-/** A marker trait for all immutable datastructures such as immutable
+/** A marker trait for all immutable data structures such as immutable
* collections.
*
* @since 2.8
diff --git a/src/library/scala/Int.scala b/src/library/scala/Int.scala
index b605af5e37..491094cfde 100644
--- a/src/library/scala/Int.scala
+++ b/src/library/scala/Int.scala
@@ -439,10 +439,10 @@ final abstract class Int private extends AnyVal {
}
object Int extends AnyValCompanion {
- /** The smallest value representable as a Int. */
+ /** The smallest value representable as an Int. */
final val MinValue = java.lang.Integer.MIN_VALUE
- /** The largest value representable as a Int. */
+ /** The largest value representable as an Int. */
final val MaxValue = java.lang.Integer.MAX_VALUE
/** Transform a value type into a boxed reference type.
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index 39c583e63b..c7894a45b8 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -107,7 +107,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
def isDefined: Boolean = !isEmpty
/** Returns the option's value.
- * @note The option must be nonEmpty.
+ * @note The option must be nonempty.
* @throws java.util.NoSuchElementException if the option is empty.
*/
def get: A
diff --git a/src/library/scala/Product1.scala b/src/library/scala/Product1.scala
index e82300adf6..3b0194e41f 100644
--- a/src/library/scala/Product1.scala
+++ b/src/library/scala/Product1.scala
@@ -14,7 +14,7 @@ object Product1 {
Some(x)
}
-/** Product1 is a cartesian product of 1 component.
+/** Product1 is a Cartesian product of 1 component.
* @since 2.3
*/
trait Product1[@specialized(Int, Long, Double) +T1] extends Any with Product {
diff --git a/src/library/scala/Product10.scala b/src/library/scala/Product10.scala
index 5fc4874048..8826d95007 100644
--- a/src/library/scala/Product10.scala
+++ b/src/library/scala/Product10.scala
@@ -14,7 +14,7 @@ object Product10 {
Some(x)
}
-/** Product10 is a cartesian product of 10 components.
+/** Product10 is a Cartesian product of 10 components.
* @since 2.3
*/
trait Product10[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10] extends Any with Product {
diff --git a/src/library/scala/Product11.scala b/src/library/scala/Product11.scala
index dcebc90e3e..2a846fff4e 100644
--- a/src/library/scala/Product11.scala
+++ b/src/library/scala/Product11.scala
@@ -14,7 +14,7 @@ object Product11 {
Some(x)
}
-/** Product11 is a cartesian product of 11 components.
+/** Product11 is a Cartesian product of 11 components.
* @since 2.3
*/
trait Product11[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11] extends Any with Product {
diff --git a/src/library/scala/Product12.scala b/src/library/scala/Product12.scala
index 2221170452..87419048d6 100644
--- a/src/library/scala/Product12.scala
+++ b/src/library/scala/Product12.scala
@@ -14,7 +14,7 @@ object Product12 {
Some(x)
}
-/** Product12 is a cartesian product of 12 components.
+/** Product12 is a Cartesian product of 12 components.
* @since 2.3
*/
trait Product12[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12] extends Any with Product {
diff --git a/src/library/scala/Product13.scala b/src/library/scala/Product13.scala
index e76f326766..a944279a2e 100644
--- a/src/library/scala/Product13.scala
+++ b/src/library/scala/Product13.scala
@@ -14,7 +14,7 @@ object Product13 {
Some(x)
}
-/** Product13 is a cartesian product of 13 components.
+/** Product13 is a Cartesian product of 13 components.
* @since 2.3
*/
trait Product13[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13] extends Any with Product {
diff --git a/src/library/scala/Product14.scala b/src/library/scala/Product14.scala
index a076e2cc7a..098721f216 100644
--- a/src/library/scala/Product14.scala
+++ b/src/library/scala/Product14.scala
@@ -14,7 +14,7 @@ object Product14 {
Some(x)
}
-/** Product14 is a cartesian product of 14 components.
+/** Product14 is a Cartesian product of 14 components.
* @since 2.3
*/
trait Product14[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14] extends Any with Product {
diff --git a/src/library/scala/Product15.scala b/src/library/scala/Product15.scala
index 4568aff1fe..ef550c80d2 100644
--- a/src/library/scala/Product15.scala
+++ b/src/library/scala/Product15.scala
@@ -14,7 +14,7 @@ object Product15 {
Some(x)
}
-/** Product15 is a cartesian product of 15 components.
+/** Product15 is a Cartesian product of 15 components.
* @since 2.3
*/
trait Product15[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15] extends Any with Product {
diff --git a/src/library/scala/Product16.scala b/src/library/scala/Product16.scala
index 84dccb0ac8..dd32e2f637 100644
--- a/src/library/scala/Product16.scala
+++ b/src/library/scala/Product16.scala
@@ -14,7 +14,7 @@ object Product16 {
Some(x)
}
-/** Product16 is a cartesian product of 16 components.
+/** Product16 is a Cartesian product of 16 components.
* @since 2.3
*/
trait Product16[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16] extends Any with Product {
diff --git a/src/library/scala/Product17.scala b/src/library/scala/Product17.scala
index 0d50898bf4..e97cc5189e 100644
--- a/src/library/scala/Product17.scala
+++ b/src/library/scala/Product17.scala
@@ -14,7 +14,7 @@ object Product17 {
Some(x)
}
-/** Product17 is a cartesian product of 17 components.
+/** Product17 is a Cartesian product of 17 components.
* @since 2.3
*/
trait Product17[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17] extends Any with Product {
diff --git a/src/library/scala/Product18.scala b/src/library/scala/Product18.scala
index 9b32265d71..1266b77a9f 100644
--- a/src/library/scala/Product18.scala
+++ b/src/library/scala/Product18.scala
@@ -14,7 +14,7 @@ object Product18 {
Some(x)
}
-/** Product18 is a cartesian product of 18 components.
+/** Product18 is a Cartesian product of 18 components.
* @since 2.3
*/
trait Product18[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18] extends Any with Product {
diff --git a/src/library/scala/Product19.scala b/src/library/scala/Product19.scala
index fe6b95669b..4bf5dcf23e 100644
--- a/src/library/scala/Product19.scala
+++ b/src/library/scala/Product19.scala
@@ -14,7 +14,7 @@ object Product19 {
Some(x)
}
-/** Product19 is a cartesian product of 19 components.
+/** Product19 is a Cartesian product of 19 components.
* @since 2.3
*/
trait Product19[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19] extends Any with Product {
diff --git a/src/library/scala/Product2.scala b/src/library/scala/Product2.scala
index 091bcc89de..93144abeb3 100644
--- a/src/library/scala/Product2.scala
+++ b/src/library/scala/Product2.scala
@@ -14,7 +14,7 @@ object Product2 {
Some(x)
}
-/** Product2 is a cartesian product of 2 components.
+/** Product2 is a Cartesian product of 2 components.
* @since 2.3
*/
trait Product2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, Double) +T2] extends Any with Product {
diff --git a/src/library/scala/Product20.scala b/src/library/scala/Product20.scala
index 81315e3558..a1dfd469ad 100644
--- a/src/library/scala/Product20.scala
+++ b/src/library/scala/Product20.scala
@@ -14,7 +14,7 @@ object Product20 {
Some(x)
}
-/** Product20 is a cartesian product of 20 components.
+/** Product20 is a Cartesian product of 20 components.
* @since 2.3
*/
trait Product20[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20] extends Any with Product {
diff --git a/src/library/scala/Product21.scala b/src/library/scala/Product21.scala
index b5967c06e1..4f01277ad3 100644
--- a/src/library/scala/Product21.scala
+++ b/src/library/scala/Product21.scala
@@ -14,7 +14,7 @@ object Product21 {
Some(x)
}
-/** Product21 is a cartesian product of 21 components.
+/** Product21 is a Cartesian product of 21 components.
* @since 2.3
*/
trait Product21[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21] extends Any with Product {
diff --git a/src/library/scala/Product22.scala b/src/library/scala/Product22.scala
index c7b9da5ce8..cef8d30402 100644
--- a/src/library/scala/Product22.scala
+++ b/src/library/scala/Product22.scala
@@ -14,7 +14,7 @@ object Product22 {
Some(x)
}
-/** Product22 is a cartesian product of 22 components.
+/** Product22 is a Cartesian product of 22 components.
* @since 2.3
*/
trait Product22[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21, +T22] extends Any with Product {
diff --git a/src/library/scala/Product3.scala b/src/library/scala/Product3.scala
index 7154bf5bdf..7da324106d 100644
--- a/src/library/scala/Product3.scala
+++ b/src/library/scala/Product3.scala
@@ -14,7 +14,7 @@ object Product3 {
Some(x)
}
-/** Product3 is a cartesian product of 3 components.
+/** Product3 is a Cartesian product of 3 components.
* @since 2.3
*/
trait Product3[+T1, +T2, +T3] extends Any with Product {
diff --git a/src/library/scala/Product4.scala b/src/library/scala/Product4.scala
index 046f8c7a7c..88e5dea9d3 100644
--- a/src/library/scala/Product4.scala
+++ b/src/library/scala/Product4.scala
@@ -14,7 +14,7 @@ object Product4 {
Some(x)
}
-/** Product4 is a cartesian product of 4 components.
+/** Product4 is a Cartesian product of 4 components.
* @since 2.3
*/
trait Product4[+T1, +T2, +T3, +T4] extends Any with Product {
diff --git a/src/library/scala/Product5.scala b/src/library/scala/Product5.scala
index 3e952c8c55..d8c3ffc190 100644
--- a/src/library/scala/Product5.scala
+++ b/src/library/scala/Product5.scala
@@ -14,7 +14,7 @@ object Product5 {
Some(x)
}
-/** Product5 is a cartesian product of 5 components.
+/** Product5 is a Cartesian product of 5 components.
* @since 2.3
*/
trait Product5[+T1, +T2, +T3, +T4, +T5] extends Any with Product {
diff --git a/src/library/scala/Product6.scala b/src/library/scala/Product6.scala
index 010c68711a..ab50d678fc 100644
--- a/src/library/scala/Product6.scala
+++ b/src/library/scala/Product6.scala
@@ -14,7 +14,7 @@ object Product6 {
Some(x)
}
-/** Product6 is a cartesian product of 6 components.
+/** Product6 is a Cartesian product of 6 components.
* @since 2.3
*/
trait Product6[+T1, +T2, +T3, +T4, +T5, +T6] extends Any with Product {
diff --git a/src/library/scala/Product7.scala b/src/library/scala/Product7.scala
index 24e5a5c05a..efdeb142d1 100644
--- a/src/library/scala/Product7.scala
+++ b/src/library/scala/Product7.scala
@@ -14,7 +14,7 @@ object Product7 {
Some(x)
}
-/** Product7 is a cartesian product of 7 components.
+/** Product7 is a Cartesian product of 7 components.
* @since 2.3
*/
trait Product7[+T1, +T2, +T3, +T4, +T5, +T6, +T7] extends Any with Product {
diff --git a/src/library/scala/Product8.scala b/src/library/scala/Product8.scala
index 4a9f65b00e..743c0ac485 100644
--- a/src/library/scala/Product8.scala
+++ b/src/library/scala/Product8.scala
@@ -14,7 +14,7 @@ object Product8 {
Some(x)
}
-/** Product8 is a cartesian product of 8 components.
+/** Product8 is a Cartesian product of 8 components.
* @since 2.3
*/
trait Product8[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8] extends Any with Product {
diff --git a/src/library/scala/Product9.scala b/src/library/scala/Product9.scala
index 9af11f709a..8d04213cd9 100644
--- a/src/library/scala/Product9.scala
+++ b/src/library/scala/Product9.scala
@@ -14,7 +14,7 @@ object Product9 {
Some(x)
}
-/** Product9 is a cartesian product of 9 components.
+/** Product9 is a Cartesian product of 9 components.
* @since 2.3
*/
trait Product9[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9] extends Any with Product {
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index 1426278954..d000d22f72 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -686,15 +686,15 @@ trait Iterator[+A] extends TraversableOnce[A] {
* handling of structural calls. It's not what's intended here.
*/
class Leading extends AbstractIterator[A] {
- var lookahead: mutable.Queue[A] = null
- var hd: A = _
+ private[this] var lookahead: mutable.Queue[A] = null
+ private[this] var hd: A = _
/* Status is kept with magic numbers
* 1 means next element is in hd and we're still reading into this iterator
* 0 means we're still reading but haven't found a next element
* -1 means we are done reading into the iterator, so we must rely on lookahead
* -2 means we are done but have saved hd for the other iterator to use as its first element
*/
- var status = 0
+ private[this] var status = 0
private def store(a: A) {
if (lookahead == null) lookahead = new mutable.Queue[A]
lookahead += a
@@ -718,34 +718,31 @@ trait Iterator[+A] extends TraversableOnce[A] {
}
else empty.next()
}
- def finish(): Boolean = {
- if (status == -1) false
- else if (status == -2) {
+ def finish(): Boolean = status match {
+ case -2 => status = -1 ; true
+ case -1 => false
+ case 1 => store(hd) ; status = 0 ; finish()
+ case 0 =>
status = -1
- true
- }
- else {
- if (status == 1) store(hd)
while (self.hasNext) {
val a = self.next()
if (p(a)) store(a)
else {
hd = a
- status = -1
return true
}
}
false
- }
}
+ def trailer: A = hd
}
val leading = new Leading
val trailing = new AbstractIterator[A] {
private[this] var myLeading = leading
- /* Status flags meanings:
- * -1 not yet accesssed
+ /* Status flag meanings:
+ * -1 not yet accessed
* 0 single element waiting in leading
* 1 defer to self
*/
@@ -770,7 +767,7 @@ trait Iterator[+A] extends TraversableOnce[A] {
if (status > 0) self.next()
else {
status = 1
- val ans = myLeading.hd
+ val ans = myLeading.trailer
myLeading = null
ans
}
diff --git a/src/library/scala/collection/Parallelizable.scala b/src/library/scala/collection/Parallelizable.scala
index b737752458..c131556388 100644
--- a/src/library/scala/collection/Parallelizable.scala
+++ b/src/library/scala/collection/Parallelizable.scala
@@ -12,7 +12,7 @@ package collection
import parallel.Combiner
/** This trait describes collections which can be turned into parallel collections
- * by invoking the method `par`. Parallelizable collections may be parametrized with
+ * by invoking the method `par`. Parallelizable collections may be parameterized with
* a target type different than their own.
*
* @tparam A the type of the elements in the collection
diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala
index 9143c40870..440452ce99 100644
--- a/src/library/scala/collection/SetLike.scala
+++ b/src/library/scala/collection/SetLike.scala
@@ -213,9 +213,9 @@ self =>
}
}
- /** An Iterator include all subsets containing exactly len elements.
+ /** An Iterator including all subsets containing exactly len elements.
* If the elements in 'This' type is ordered, then the subsets will also be in the same order.
- * ListSet(1,2,3).subsets => {1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}
+ * ListSet(1,2,3).subsets => {{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}
*
* @author Eastsun
* @date 2010.12.6
diff --git a/src/library/scala/collection/SortedSet.scala b/src/library/scala/collection/SortedSet.scala
index 43189d2e8c..0fa5ce0966 100644
--- a/src/library/scala/collection/SortedSet.scala
+++ b/src/library/scala/collection/SortedSet.scala
@@ -29,6 +29,6 @@ trait SortedSet[A] extends Set[A] with SortedSetLike[A, SortedSet[A]] {
object SortedSet extends SortedSetFactory[SortedSet] {
def empty[A](implicit ord: Ordering[A]): immutable.SortedSet[A] = immutable.SortedSet.empty[A](ord)
def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = newCanBuildFrom[A]
- // Force a declaration here so that BitSet's (which does not inherit from SortedSetFactory) can be more specific
+ // Force a declaration here so that BitSet (which does not inherit from SortedSetFactory) can be more specific
override implicit def newCanBuildFrom[A](implicit ord : Ordering[A]) : CanBuildFrom[Coll, A, SortedSet[A]] = super.newCanBuildFrom
}
diff --git a/src/library/scala/collection/generic/GenTraversableFactory.scala b/src/library/scala/collection/generic/GenTraversableFactory.scala
index 2092c0c5f5..7c2aa5615c 100644
--- a/src/library/scala/collection/generic/GenTraversableFactory.scala
+++ b/src/library/scala/collection/generic/GenTraversableFactory.scala
@@ -229,7 +229,7 @@ extends GenericCompanion[CC] {
/** Produces a $coll containing repeated applications of a function to a start value.
*
* @param start the start value of the $coll
- * @param len the number of elements contained inthe $coll
+ * @param len the number of elements contained in the $coll
* @param f the function that's repeatedly applied
* @return a $coll with `len` values in the sequence `start, f(start), f(f(start)), ...`
*/
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index 45b761fc00..e5444533a8 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -400,7 +400,7 @@ sealed abstract class List[+A] extends AbstractSeq[A]
else new Stream.Cons(head, tail.toStream)
// Create a proxy for Java serialization that allows us to avoid mutation
- // during de-serialization. This is the Serialization Proxy Pattern.
+ // during deserialization. This is the Serialization Proxy Pattern.
protected final def writeReplace(): AnyRef = new List.SerializationProxy(this)
}
@@ -468,7 +468,7 @@ object List extends SeqFactory[List] {
out.writeObject(ListSerializeEnd)
}
- // Java serialization calls this before readResolve during de-serialization.
+ // Java serialization calls this before readResolve during deserialization.
// Read the whole list and store it in `orig`.
private def readObject(in: ObjectInputStream) {
in.defaultReadObject()
diff --git a/src/library/scala/collection/immutable/SetProxy.scala b/src/library/scala/collection/immutable/SetProxy.scala
index e1cf3620a2..b421b48597 100644
--- a/src/library/scala/collection/immutable/SetProxy.scala
+++ b/src/library/scala/collection/immutable/SetProxy.scala
@@ -12,8 +12,7 @@ package scala
package collection
package immutable
-/** This is a simple wrapper class for <a href="Set.html"
- * target="contentFrame">`scala.collection.immutable.Set`</a>.
+/** This is a simple wrapper class for [[scala.collection.immutable.Set]].
*
* It is most useful for assembling customized set abstractions
* dynamically using object composition and forwarding.
diff --git a/src/library/scala/collection/immutable/SortedSet.scala b/src/library/scala/collection/immutable/SortedSet.scala
index 107f77f287..75b2b1f4dc 100644
--- a/src/library/scala/collection/immutable/SortedSet.scala
+++ b/src/library/scala/collection/immutable/SortedSet.scala
@@ -37,6 +37,6 @@ object SortedSet extends ImmutableSortedSetFactory[SortedSet] {
/** $sortedSetCanBuildFromInfo */
def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = newCanBuildFrom[A]
def empty[A](implicit ord: Ordering[A]): SortedSet[A] = TreeSet.empty[A]
- // Force a declaration here so that BitSet's (which does not inherit from SortedSetFactory) can be more specific
+ // Force a declaration here so that BitSet (which does not inherit from SortedSetFactory) can be more specific
override implicit def newCanBuildFrom[A](implicit ord : Ordering[A]) : CanBuildFrom[Coll, A, SortedSet[A]] = super.newCanBuildFrom
}
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index a162fdaaf8..d9d925705f 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -11,7 +11,6 @@ package collection
package immutable
import scala.annotation.unchecked.uncheckedVariance
-import scala.compat.Platform
import scala.collection.generic._
import scala.collection.mutable.{Builder, ReusableBuilder}
import scala.collection.parallel.immutable.ParVector
@@ -478,12 +477,12 @@ override def companion: GenericCompanion[Vector] = Vector
// if (array eq null)
// println("OUCH!!! " + right + "/" + depth + "/"+startIndex + "/" + endIndex + "/" + focus)
val a2 = new Array[AnyRef](array.length)
- Platform.arraycopy(array, 0, a2, 0, right)
+ java.lang.System.arraycopy(array, 0, a2, 0, right)
a2
}
private def copyRight(array: Array[AnyRef], left: Int): Array[AnyRef] = {
val a2 = new Array[AnyRef](array.length)
- Platform.arraycopy(array, left, a2, left, a2.length - left)
+ java.lang.System.arraycopy(array, left, a2, left, a2.length - left)
a2
}
@@ -955,7 +954,7 @@ private[immutable] trait VectorPointer[T] {
private[immutable] final def copyOf(a: Array[AnyRef]) = {
val b = new Array[AnyRef](a.length)
- Platform.arraycopy(a, 0, b, 0, a.length)
+ java.lang.System.arraycopy(a, 0, b, 0, a.length)
b
}
@@ -1119,7 +1118,7 @@ private[immutable] trait VectorPointer[T] {
private[immutable] final def copyRange(array: Array[AnyRef], oldLeft: Int, newLeft: Int) = {
val elems = new Array[AnyRef](32)
- Platform.arraycopy(array, oldLeft, elems, newLeft, 32 - math.max(newLeft,oldLeft))
+ java.lang.System.arraycopy(array, oldLeft, elems, newLeft, 32 - math.max(newLeft,oldLeft))
elems
}
diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala
index 167e04ccbd..23d386f729 100644
--- a/src/library/scala/collection/mutable/ArrayBuffer.scala
+++ b/src/library/scala/collection/mutable/ArrayBuffer.scala
@@ -67,7 +67,7 @@ class ArrayBuffer[A](override protected val initialSize: Int)
override def sizeHint(len: Int) {
if (len > size && len >= 1) {
val newarray = new Array[AnyRef](len)
- scala.compat.Platform.arraycopy(array, 0, newarray, 0, size0)
+ java.lang.System.arraycopy(array, 0, newarray, 0, size0)
array = newarray
}
}
diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala
index bb15788bdf..bd6fb508fe 100644
--- a/src/library/scala/collection/mutable/HashTable.scala
+++ b/src/library/scala/collection/mutable/HashTable.scala
@@ -396,11 +396,11 @@ private[collection] object HashTable {
/** The load factor for the hash table (in 0.001 step).
*/
private[collection] final def defaultLoadFactor: Int = 750 // corresponds to 75%
- private[collection] final def loadFactorDenum = 1000
+ private[collection] final def loadFactorDenom = 1000
- private[collection] final def newThreshold(_loadFactor: Int, size: Int) = ((size.toLong * _loadFactor) / loadFactorDenum).toInt
+ private[collection] final def newThreshold(_loadFactor: Int, size: Int) = ((size.toLong * _loadFactor) / loadFactorDenom).toInt
- private[collection] final def sizeForThreshold(_loadFactor: Int, thr: Int) = ((thr.toLong * loadFactorDenum) / _loadFactor).toInt
+ private[collection] final def sizeForThreshold(_loadFactor: Int, thr: Int) = ((thr.toLong * loadFactorDenom) / _loadFactor).toInt
private[collection] final def capacity(expectedSize: Int) = if (expectedSize == 0) 1 else powerOfTwo(expectedSize)
diff --git a/src/library/scala/collection/mutable/History.scala b/src/library/scala/collection/mutable/History.scala
index 19148c0ac2..13e2f32225 100644
--- a/src/library/scala/collection/mutable/History.scala
+++ b/src/library/scala/collection/mutable/History.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/tPFL **
+** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index 107a2bfa0e..ed43ef6db9 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -331,8 +331,8 @@ sealed class PriorityQueue[A](implicit val ord: Ordering[A])
val pq = new PriorityQueue[A]
val n = resarr.p_size0
pq.resarr.p_ensureSize(n)
+ java.lang.System.arraycopy(resarr.p_array, 1, pq.resarr.p_array, 1, n-1)
pq.resarr.p_size0 = n
- scala.compat.Platform.arraycopy(resarr.p_array, 1, pq.resarr.p_array, 1, n-1)
pq
}
}
diff --git a/src/library/scala/collection/mutable/ResizableArray.scala b/src/library/scala/collection/mutable/ResizableArray.scala
index 85a299216e..50d3513784 100644
--- a/src/library/scala/collection/mutable/ResizableArray.scala
+++ b/src/library/scala/collection/mutable/ResizableArray.scala
@@ -101,7 +101,7 @@ trait ResizableArray[A] extends IndexedSeq[A]
if (newSize > Int.MaxValue) newSize = Int.MaxValue
val newArray: Array[AnyRef] = new Array(newSize.toInt)
- scala.compat.Platform.arraycopy(array, 0, newArray, 0, size0)
+ java.lang.System.arraycopy(array, 0, newArray, 0, size0)
array = newArray
}
}
diff --git a/src/library/scala/collection/mutable/ReusableBuilder.scala b/src/library/scala/collection/mutable/ReusableBuilder.scala
index 83a4fcfc29..dee2cd6393 100644
--- a/src/library/scala/collection/mutable/ReusableBuilder.scala
+++ b/src/library/scala/collection/mutable/ReusableBuilder.scala
@@ -35,7 +35,7 @@ trait ReusableBuilder[-Elem, +To] extends Builder[Elem, To] {
* If executed immediately after a call to `result`, this allows a new
* instance of the same type of collection to be built.
*/
- override def clear(): Unit // Note: overriding for scaladoc only!
+ override def clear(): Unit // Note: overriding for Scaladoc only!
/** Produces a collection from the added elements.
*
@@ -45,5 +45,5 @@ trait ReusableBuilder[-Elem, +To] extends Builder[Elem, To] {
*
* @return a collection containing the elements added to this builder.
*/
- override def result(): To // Note: overriding for scaladoc only!
+ override def result(): To // Note: overriding for Scaladoc only!
}
diff --git a/src/library/scala/collection/parallel/TaskSupport.scala b/src/library/scala/collection/parallel/TaskSupport.scala
index 728605af7b..4d633253ce 100644
--- a/src/library/scala/collection/parallel/TaskSupport.scala
+++ b/src/library/scala/collection/parallel/TaskSupport.scala
@@ -16,7 +16,7 @@ import scala.concurrent.ExecutionContext
/** A trait implementing the scheduling of a parallel collection operation.
*
* Parallel collections are modular in the way operations are scheduled. Each
- * parallel collection is parametrized with a task support object which is
+ * parallel collection is parameterized with a task support object which is
* responsible for scheduling and load-balancing tasks to processors.
*
* A task support object can be changed in a parallel collection after it has
@@ -71,7 +71,7 @@ extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks
* forkjoin based task support or a thread pool executor one, depending on
* what the execution context uses.
*
- * By default, parallel collections are parametrized with this task support
+ * By default, parallel collections are parameterized with this task support
* object, so parallel collections share the same execution context backend
* as the rest of the `scala.concurrent` package.
*
diff --git a/src/library/scala/collection/parallel/immutable/ParRange.scala b/src/library/scala/collection/parallel/immutable/ParRange.scala
index 8fd5382ce9..de2b53a6c0 100644
--- a/src/library/scala/collection/parallel/immutable/ParRange.scala
+++ b/src/library/scala/collection/parallel/immutable/ParRange.scala
@@ -107,6 +107,7 @@ self =>
}
}
+ override def toString = s"Par$range"
}
object ParRange {
diff --git a/src/library/scala/concurrent/duration/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala
index f69030bd3d..d912f614c2 100644
--- a/src/library/scala/concurrent/duration/Duration.scala
+++ b/src/library/scala/concurrent/duration/Duration.scala
@@ -47,7 +47,7 @@ object Duration {
* whitespace is allowed before, between and after the parts. Infinities are
* designated by `"Inf"`, `"PlusInf"`, `"+Inf"` and `"-Inf"` or `"MinusInf"`.
*
- * @throws NumberFormatException if format is not parseable
+ * @throws NumberFormatException if format is not parsable
*/
def apply(s: String): Duration = {
val s1: String = s filterNot (_.isWhitespace)
@@ -120,7 +120,7 @@ object Duration {
def fromNanos(nanos: Double): Duration = {
if (nanos.isInfinite)
if (nanos > 0) Inf else MinusInf
- else if (nanos.isNaN)
+ else if (JDouble.isNaN(nanos))
Undefined
else if (nanos > Long.MaxValue || nanos < Long.MinValue)
throw new IllegalArgumentException("trying to construct too large duration with " + nanos + "ns")
@@ -196,11 +196,11 @@ object Duration {
}
def *(factor: Double): Duration =
- if (factor == 0d || factor.isNaN) Undefined
+ if (factor == 0d || JDouble.isNaN(factor)) Undefined
else if (factor < 0d) -this
else this
def /(divisor: Double): Duration =
- if (divisor.isNaN || divisor.isInfinite) Undefined
+ if (JDouble.isNaN(divisor) || divisor.isInfinite) Undefined
else if ((divisor compare 0d) < 0) -this
else this
def /(divisor: Duration): Double = divisor match {
@@ -285,7 +285,7 @@ object Duration {
* whitespace is allowed before, between and after the parts. Infinities are
* designated by `"Inf"`, `"PlusInf"`, `"+Inf"` and `"-Inf"` or `"MinusInf"`.
*
- * @throws NumberFormatException if format is not parseable
+ * @throws NumberFormatException if format is not parsable
*/
def create(s: String): Duration = apply(s)
@@ -627,13 +627,13 @@ final class FiniteDuration(val length: Long, val unit: TimeUnit) extends Duratio
def *(factor: Double) =
if (!factor.isInfinite) fromNanos(toNanos * factor)
- else if (factor.isNaN) Undefined
+ else if (JDouble.isNaN(factor)) Undefined
else if ((factor > 0) ^ (this < Zero)) Inf
else MinusInf
def /(divisor: Double) =
if (!divisor.isInfinite) fromNanos(toNanos / divisor)
- else if (divisor.isNaN) Undefined
+ else if (JDouble.isNaN(divisor)) Undefined
else Zero
// if this is made a constant, then scalac will elide the conditional and always return +0.0, SI-6331
diff --git a/src/library/scala/concurrent/impl/ExecutionContextImpl.scala b/src/library/scala/concurrent/impl/ExecutionContextImpl.scala
index 7bf5cc5729..19233d7531 100644
--- a/src/library/scala/concurrent/impl/ExecutionContextImpl.scala
+++ b/src/library/scala/concurrent/impl/ExecutionContextImpl.scala
@@ -100,7 +100,7 @@ private[concurrent] object ExecutionContextImpl {
val numThreads = getInt("scala.concurrent.context.numThreads", "x1")
// The hard limit on the number of active threads that the thread factory will produce
// SI-8955 Deadlocks can happen if maxNoOfThreads is too low, although we're currently not sure
- // about what the exact threshhold is. numThreads + 256 is conservatively high.
+ // about what the exact threshold is. numThreads + 256 is conservatively high.
val maxNoOfThreads = getInt("scala.concurrent.context.maxThreads", "x1")
val desiredParallelism = range(
diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala
index 626540425f..7fcc8c9f2d 100644
--- a/src/library/scala/concurrent/impl/Promise.scala
+++ b/src/library/scala/concurrent/impl/Promise.scala
@@ -384,7 +384,7 @@ private[concurrent] object Promise {
private[this] final def thisAs[S]: Future[S] = future.asInstanceOf[Future[S]]
override def onSuccess[U](pf: PartialFunction[T, U])(implicit executor: ExecutionContext): Unit = ()
- override def failed: Future[Throwable] = thisAs[Throwable]
+ override def failed: Future[Throwable] = KeptPromise(Success(result.exception)).future
override def foreach[U](f: T => U)(implicit executor: ExecutionContext): Unit = ()
override def map[S](f: T => S)(implicit executor: ExecutionContext): Future[S] = thisAs[S]
override def flatMap[S](f: T => Future[S])(implicit executor: ExecutionContext): Future[S] = thisAs[S]
diff --git a/src/library/scala/io/Source.scala b/src/library/scala/io/Source.scala
index 7513b423a1..b4f542a252 100644
--- a/src/library/scala/io/Source.scala
+++ b/src/library/scala/io/Source.scala
@@ -59,7 +59,7 @@ object Source {
def fromFile(name: String, enc: String): BufferedSource =
fromFile(name)(Codec(enc))
- /** creates `ource` from file with given file `URI`.
+ /** creates `source` from file with given file `URI`.
*/
def fromFile(uri: URI)(implicit codec: Codec): BufferedSource =
fromFile(new JFile(uri))(codec)
diff --git a/src/library/scala/math/BigInt.scala b/src/library/scala/math/BigInt.scala
index 3ae3b9bf6c..707a5c0769 100644
--- a/src/library/scala/math/BigInt.scala
+++ b/src/library/scala/math/BigInt.scala
@@ -160,8 +160,8 @@ final class BigInt(val bigInteger: BigInteger)
}
) && !bitLengthOverflow
}
- /** Some implementations of java.math.BigInteger allow huge values with bit length greater than Int.MaxValue .
- * The BigInteger.bitLength method returns truncated bit length in this case .
+ /** Some implementations of java.math.BigInteger allow huge values with bit length greater than Int.MaxValue.
+ * The BigInteger.bitLength method returns truncated bit length in this case.
* This method tests if result of bitLength is valid.
* This method will become unnecessary if BigInt constructors reject huge BigIntegers.
*/
diff --git a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
index cd46f0ff76..d2ae10747d 100644
--- a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
+++ b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
@@ -143,8 +143,8 @@ trait ClassManifestDeprecatedApis[T] extends OptManifest[T] {
* This is done to prevent avalanches of deprecation warnings in the code that calls methods with manifests.
*
* In a perfect world, we would just remove the @deprecated annotation from `ClassManifest` the object
- * and then delete it in 2.11. After all, that object is explicitly marked as internal, so noone should use it.
- * However a lot of existing libraries disregarded the scaladoc that comes with `ClassManifest`,
+ * and then delete it in 2.11. After all, that object is explicitly marked as internal, so no one should use it.
+ * However a lot of existing libraries disregarded the Scaladoc that comes with `ClassManifest`,
* so we need to somehow nudge them into migrating prior to removing stuff out of the blue.
* Hence we've introduced this design decision as the lesser of two evils.
*/
diff --git a/src/library/scala/sys/process/ProcessBuilder.scala b/src/library/scala/sys/process/ProcessBuilder.scala
index fe4c30ee50..8288d8d480 100644
--- a/src/library/scala/sys/process/ProcessBuilder.scala
+++ b/src/library/scala/sys/process/ProcessBuilder.scala
@@ -342,7 +342,7 @@ object ProcessBuilder extends ProcessBuilderImpl {
/** Writes the output stream of this process to a [[scala.sys.process.ProcessBuilder]]. */
def #>(b: ProcessBuilder): ProcessBuilder = new PipedBuilder(toSource, b, false)
- /** Returnes a [[scala.sys.process.ProcessBuilder]] representing this `Source`. */
+ /** Returns a [[scala.sys.process.ProcessBuilder]] representing this `Source`. */
def cat = toSource
private def toFile(f: File, append: Boolean) = #> (new FileOutput(f, append))
}
diff --git a/src/library/scala/sys/process/package.scala b/src/library/scala/sys/process/package.scala
index bf4287dfc3..440e62b6aa 100644
--- a/src/library/scala/sys/process/package.scala
+++ b/src/library/scala/sys/process/package.scala
@@ -185,8 +185,8 @@ package scala.sys {
* new URL("http://www.scala-lang.org/") #> new File("scala-lang.html") !
* }}}
*
- * More information about the other ways of controlling I/O can be looked at
- * in the scaladoc for the associated objects, traits and classes.
+ * More information about the other ways of controlling I/O can be found
+ * in the Scaladoc for the associated objects, traits and classes.
*
* ==Running the Process==
*
diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala
index 7bded972f2..523c10c483 100644
--- a/src/library/scala/util/Either.scala
+++ b/src/library/scala/util/Either.scala
@@ -74,7 +74,7 @@ package util
* } yield a + b + c // Left(23.0)
*
* // It is advisable to provide the type of the “missing” value (especially the right value for `Left`)
- * // as otherwise that type might be infered as `Nothing` without context:
+ * // as otherwise that type might be inferred as `Nothing` without context:
* for {
* a <- left23
* b <- right1
diff --git a/src/manual/scala/man1/scalac.scala b/src/manual/scala/man1/scalac.scala
index 79c175e0f0..b4d479cb85 100644
--- a/src/manual/scala/man1/scalac.scala
+++ b/src/manual/scala/man1/scalac.scala
@@ -180,7 +180,7 @@ object scalac extends Command {
Mono(Bold("@") & Argument("file")),
"A text file containing compiler arguments (options and source files)")
- // TODO - Add macros an dsuch here.
+ // TODO - Add macros and such here.
)
),
@@ -474,7 +474,7 @@ object scalac extends Command {
val exitStatus = Section("EXIT STATUS",
- MBold(command) & " returns a zero exist status if it succeeds to " &
+ MBold(command) & " returns a zero exit status if it succeeds to " &
"compile the specified input files. Non zero is returned in case " &
"of failure.")
diff --git a/src/manual/scala/man1/scalap.scala b/src/manual/scala/man1/scalap.scala
index 472b522e17..b58fe6a81f 100644
--- a/src/manual/scala/man1/scalap.scala
+++ b/src/manual/scala/man1/scalap.scala
@@ -76,7 +76,7 @@ object scalap extends Command {
val exitStatus = Section("EXIT STATUS",
- MBold(command) & " returns a zero exist status if it succeeds to process " &
+ MBold(command) & " returns a zero exit status if it succeeds to process " &
"the specified input files. Non zero is returned in case of failure.")
override val authors = Section("AUTHOR",
diff --git a/src/partest-extras/scala/tools/partest/JavapTest.scala b/src/partest-extras/scala/tools/partest/JavapTest.scala
index 27017b1585..cfca49b3a7 100644
--- a/src/partest-extras/scala/tools/partest/JavapTest.scala
+++ b/src/partest-extras/scala/tools/partest/JavapTest.scala
@@ -8,7 +8,7 @@ import java.lang.System.{out => sysout}
*/
abstract class JavapTest extends ReplTest {
- /** Your Assertion Here, whatever you want to bejahen.
+ /** Your Assertion Here, whatever you want to affirm.
* Assertions must be satisfied by all flavors of javap
* and should not be fragile with respect to compiler output.
*/
diff --git a/src/partest-extras/scala/tools/partest/ReplTest.scala b/src/partest-extras/scala/tools/partest/ReplTest.scala
index 608ac73b61..9c95a718ca 100644
--- a/src/partest-extras/scala/tools/partest/ReplTest.scala
+++ b/src/partest-extras/scala/tools/partest/ReplTest.scala
@@ -74,7 +74,7 @@ abstract class SessionTest extends ReplTest {
/** Code is the command list culled from the session (or the expected session output).
* Would be nicer if code were lazy lines so you could generate arbitrarily long text.
- * Retain user input: prompt lines and continuations, without the prefix; or pasted text plus ctl-D.
+ * Retain user input: prompt lines and continuations, without the prefix; or pasted text plus ctrl-D.
*/
import SessionTest._
lazy val pasted = input(prompt)
diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala
index 2c8f84be0b..c2339700de 100644
--- a/src/reflect/scala/reflect/api/Internals.scala
+++ b/src/reflect/scala/reflect/api/Internals.scala
@@ -1012,7 +1012,7 @@ trait Internals { self: Universe =>
*/
def origin: String
- /** The valus this symbol refers to
+ /** The value this symbol refers to
*
* @group FreeTerm
*/
diff --git a/src/reflect/scala/reflect/api/StandardDefinitions.scala b/src/reflect/scala/reflect/api/StandardDefinitions.scala
index bf9cf5e334..50954f5eda 100644
--- a/src/reflect/scala/reflect/api/StandardDefinitions.scala
+++ b/src/reflect/scala/reflect/api/StandardDefinitions.scala
@@ -214,7 +214,7 @@ trait StandardDefinitions {
/** The module symbol of module `scala.Some`. */
def SomeModule: ModuleSymbol
- /** Function-like api that lets you acess symbol
+ /** Function-like api that lets you access symbol
* of the definition with given arity and also look
* through all known symbols via `seq`.
*/
diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala
index ff61ae1901..9e05a7f979 100644
--- a/src/reflect/scala/reflect/api/Types.scala
+++ b/src/reflect/scala/reflect/api/Types.scala
@@ -734,7 +734,7 @@ trait Types {
*/
val MethodType: MethodTypeExtractor
- /** An extractor class to create and pattern match with syntax `MethodType(params, respte)`
+ /** An extractor class to create and pattern match with syntax `MethodType(params, restpe)`
* Here, `params` is a potentially empty list of parameter symbols of the method,
* and `restpe` is the result type of the method. If the method is curried, `restpe` would
* be another `MethodType`.
diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
index cfde164754..a6e584424b 100644
--- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
@@ -412,7 +412,7 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
/** Extracts the type of the thrown exception from an AnnotationInfo.
*
* Supports both “old-style” `@throws(classOf[Exception])`
- * as well as “new-stye” `@throws[Exception]("cause")` annotations.
+ * as well as “new-style” `@throws[Exception]("cause")` annotations.
*/
object ThrownException {
def unapply(ann: AnnotationInfo): Option[Type] = {
diff --git a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala
index 78f9721713..0ef52213e5 100644
--- a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala
+++ b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala
@@ -100,7 +100,7 @@ trait BaseTypeSeqs {
def copy(head: Type, offset: Int): BaseTypeSeq = {
val arr = new Array[Type](elems.length + offset)
- scala.compat.Platform.arraycopy(elems, 0, arr, offset, elems.length)
+ java.lang.System.arraycopy(elems, 0, arr, offset, elems.length)
arr(0) = head
newBaseTypeSeq(parents, arr)
}
diff --git a/src/reflect/scala/reflect/internal/Constants.scala b/src/reflect/scala/reflect/internal/Constants.scala
index 7b47798ff7..cd2debfaf4 100644
--- a/src/reflect/scala/reflect/internal/Constants.scala
+++ b/src/reflect/scala/reflect/internal/Constants.scala
@@ -87,8 +87,8 @@ trait Constants extends api.Constants {
}
def isNaN = value match {
- case f: Float => f.isNaN
- case d: Double => d.isNaN
+ case f: Float => java.lang.Float.isNaN(f)
+ case d: Double => java.lang.Double.isNaN(d)
case _ => false
}
diff --git a/src/reflect/scala/reflect/internal/Names.scala b/src/reflect/scala/reflect/internal/Names.scala
index 97f51149ba..9d39ef8b42 100644
--- a/src/reflect/scala/reflect/internal/Names.scala
+++ b/src/reflect/scala/reflect/internal/Names.scala
@@ -68,7 +68,7 @@ trait Names extends api.Names {
while (i < len) {
if (nc + i == chrs.length) {
val newchrs = new Array[Char](chrs.length * 2)
- scala.compat.Platform.arraycopy(chrs, 0, newchrs, 0, chrs.length)
+ java.lang.System.arraycopy(chrs, 0, newchrs, 0, chrs.length)
chrs = newchrs
}
chrs(nc + i) = cs(offset + i)
@@ -220,7 +220,7 @@ trait Names extends api.Names {
/** Copy bytes of this name to buffer cs, starting at position `offset`. */
final def copyChars(cs: Array[Char], offset: Int) =
- scala.compat.Platform.arraycopy(chrs, index, cs, offset, len)
+ java.lang.System.arraycopy(chrs, index, cs, offset, len)
/** @return the ascii representation of this name */
final def toChars: Array[Char] = { // used by ide
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 8d77e334db..56b6dc078d 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -1932,7 +1932,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
result
}
-// ------ cloneing -------------------------------------------------------------------
+// ------ cloning -------------------------------------------------------------------
/** A clone of this symbol. */
final def cloneSymbol: TypeOfClonedSymbol =
diff --git a/src/reflect/scala/reflect/internal/TreeGen.scala b/src/reflect/scala/reflect/internal/TreeGen.scala
index c5038fd1bb..4fecaf70df 100644
--- a/src/reflect/scala/reflect/internal/TreeGen.scala
+++ b/src/reflect/scala/reflect/internal/TreeGen.scala
@@ -122,7 +122,7 @@ abstract class TreeGen {
// val selType = testedBinder.info
//
// // See the test for SI-7214 for motivation for dealias. Later `treeCondStrategy#outerTest`
- // // generates an outer test based on `patType.prefix` with automatically dealises.
+ // // generates an outer test based on `patType.prefix` with automatically dealiases.
// // Prefixes can have all kinds of shapes SI-9110
// val patPre = expectedTp.dealiasWiden.prefix
// val selPre = selType.dealiasWiden.prefix
diff --git a/src/reflect/scala/reflect/internal/tpe/FindMembers.scala b/src/reflect/scala/reflect/internal/tpe/FindMembers.scala
index 83a5d23e7c..6ba48cb44d 100644
--- a/src/reflect/scala/reflect/internal/tpe/FindMembers.scala
+++ b/src/reflect/scala/reflect/internal/tpe/FindMembers.scala
@@ -125,9 +125,9 @@ trait FindMembers {
/* Add this member to the final result, unless an already-found member matches it. */
protected def addMemberIfNew(sym: Symbol): Unit
- // Is `sym` a potentially member of `baseClass`?
+ // Is `sym` potentially a member of `baseClass`?
//
- // Q. When does a potential member fail to be a an actual member?
+ // Q. When does a potential member fail to be an actual member?
// A. if it is subsumed by an member in a subclass.
private def isPotentialMember(sym: Symbol, flags: Long, owner: Symbol,
seenFirstNonRefinementClass: Boolean, refinementParents: List[Symbol]): Boolean = {
diff --git a/src/reflect/scala/reflect/runtime/JavaUniverse.scala b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
index a87d1d23cc..a9d415277b 100644
--- a/src/reflect/scala/reflect/runtime/JavaUniverse.scala
+++ b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
@@ -91,7 +91,7 @@ class JavaUniverse extends InternalSymbolTable with JavaUniverseForce with Refle
// Main challenges that runtime reflection presents wrt initialization are:
// 1) Extravagant completion scheme that enters package members on-demand rather than a result of scanning a directory with class files.
// (That's a direct consequence of the fact that in general case we can't enumerate all classes in a classloader.
- // As Paul rightfully mentioned, we could specialcase classloaders that point to filesystems, but that is left for future work).
+ // As Paul rightfully mentioned, we could special case classloaders that point to filesystems, but that is left for future work).
// 2) Presence of synthetic symbols that aren't loaded by normal means (from classfiles) but are synthesized on-the-fly,
// and the necessity to propagate these synthetic symbols from rootMirror to other mirrors,
// complicated by the fact that such symbols depend on normal symbols (e.g. AnyRef depends on Object).
diff --git a/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala
index 1f81d9965c..88a011e996 100644
--- a/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala
+++ b/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala
@@ -117,7 +117,7 @@ class SplashLoop(reader: InteractiveReader, prompt: String) extends Runnable {
thread = null
}
- /** Block for the result line, or null on ctl-D. */
+ /** Block for the result line, or null on ctrl-D. */
def line: String = result.take getOrElse null
}
object SplashLoop {
diff --git a/src/repl/scala/tools/nsc/interpreter/Phased.scala b/src/repl/scala/tools/nsc/interpreter/Phased.scala
index dd327a13d4..da77be7a79 100644
--- a/src/repl/scala/tools/nsc/interpreter/Phased.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Phased.scala
@@ -9,7 +9,7 @@ package interpreter
import scala.language.implicitConversions
/** Mix this into an object and use it as a phasing
- * swiss army knife.
+ * Swiss Army knife.
*/
trait Phased {
val global: Global
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
index 9de6ec4ab9..613bbd9aec 100644
--- a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
@@ -183,7 +183,7 @@ trait MemberLookupBase {
val member = query.substring(last_index, index).replaceAll("\\\\([#\\.])", "$1")
// we want to allow javadoc-style links [[#member]] -- which requires us to remove empty members from the first
- // elemnt in the list
+ // element in the list
if ((member != "") || (!members.isEmpty))
members ::= member
last_index = index + 1
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala
index 2deb669ea9..99af2f627f 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala
@@ -211,7 +211,7 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends
// escape HTML characters in node names
def escape(name: String) = name.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- // assemble node attribues in a map
+ // assemble node attributes in a map
val attr = scala.collection.mutable.Map[String, String]()
// link
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js
index 52fb1770ee..eb396bb5d3 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js
+++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js
@@ -65,7 +65,7 @@ function Scheduler() {
scheduler.queues[idx].push(new scheduler.work(fn, self, args));
if (scheduler.timeout == undefined) doWork();
} else {
- throw("queue for add is non existant");
+ throw("queue for add is non-existent");
}
}
@@ -86,7 +86,7 @@ function Scheduler() {
if (idx != -1)
return scheduler.queues[idx].length == 0;
else
- throw("queue for label '" + label + "' is non existant");
+ throw("queue for label '" + label + "' is non-existent");
}
this.scheduleLast = function(label, fn) {
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css
index f222749dd2..c120698e91 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css
+++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css
@@ -562,7 +562,7 @@ div#definition > h4#signature > span.modifier_kind > i.unfold-arrow,
font-weight: bold;
}
-/* Comments text formating */
+/* Comments text formatting */
.cmt {
color: #103a51;
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
index 757f13f79a..e71383f7e7 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
@@ -256,11 +256,11 @@ trait DocTemplateEntity extends MemberTemplateEntity {
* only if the `docsourceurl` setting has been set. */
def sourceUrl: Option[java.net.URL]
- /** All class, trait and object templates which are part of this template's linearization, in lineratization order.
+ /** All class, trait and object templates which are part of this template's linearization, in linearization order.
* This template's linearization contains all of its direct and indirect super-classes and super-traits. */
def linearizationTemplates: List[TemplateEntity]
- /** All instantiated types which are part of this template's linearization, in lineratization order.
+ /** All instantiated types which are part of this template's linearization, in linearization order.
* This template's linearization contains all of its direct and indirect super-types. */
def linearizationTypes: List[TypeEntity]
@@ -511,9 +511,9 @@ trait ImplicitConversion {
/** Shadowing captures the information that the member is shadowed by some other members
* There are two cases of implicitly added member shadowing:
- * 1) shadowing from a original class member (the class already has that member)
+ * 1) shadowing from an original class member (the class already has that member)
* in this case, it won't be possible to call the member directly, the type checker will fail attempting to adapt
- * the call arguments (or if they fit it will call the original class' method)
+ * the call arguments (or if they fit it will call the original class method)
* 2) shadowing from other possible implicit conversions ()
* this will result in an ambiguous implicit converion error
*/
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
index fb9a5ce7eb..6e62ce0317 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -886,8 +886,8 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
// units.filter should return only one element
(currentRun.units filter (_.source.file == aSym.sourceFile)).toList match {
case List(unit) =>
- // SI-4922 `sym == aSym` is insufficent if `aSym` is a clone of symbol
- // of the parameter in the tree, as can happen with type parametric methods.
+ // SI-4922 `sym == aSym` is insufficient if `aSym` is a clone of symbol
+ // of the parameter in the tree, as can happen with type parameterized methods.
def isCorrespondingParam(sym: Symbol) = (
sym != null &&
sym != NoSymbol &&
diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala
index d0de2f5542..a1934efdd0 100644
--- a/test/files/jvm/future-spec/FutureTests.scala
+++ b/test/files/jvm/future-spec/FutureTests.scala
@@ -123,7 +123,7 @@ class FutureTests extends MinimalScalaTest {
assert(f.mapTo[String] eq f, "Future.mapTo must be the same instance as Future.mapTo")
assert(f.zip(f) eq f, "Future.zip must be the same instance as Future.zip")
assert(f.flatten eq f, "Future.flatten must be the same instance as Future.flatten")
- assert(f.failed eq f, "Future.failed must be the same instance as Future.failed")
+ assert(f.failed.value == Some(Success(e)), "Future.failed.failed must become successful") // SI-10034
ECNotUsed(ec => f.foreach(_ => fail("foreach should not have been called"))(ec))
ECNotUsed(ec => f.onSuccess({ case _ => fail("onSuccess should not have been called") })(ec))
diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check
index 90da8a085d..da41ba4bdd 100644
--- a/test/files/jvm/serialization-new.check
+++ b/test/files/jvm/serialization-new.check
@@ -268,12 +268,12 @@ x = ParHashSet(1, 2, 3)
y = ParHashSet(1, 2, 3)
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3, 4)
-y = ParRange(0, 1, 2, 3, 4)
+x = ParRange 0 to 4
+y = ParRange 0 to 4
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3)
-y = ParRange(0, 1, 2, 3)
+x = ParRange 0 until 4
+y = ParRange 0 until 4
x equals y: true, y equals x: true
x = ParMap(5 -> 1, 10 -> 2)
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index 964c68e528..38017d829f 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -268,12 +268,12 @@ x = ParHashSet(1, 2, 3)
y = ParHashSet(1, 2, 3)
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3, 4)
-y = ParRange(0, 1, 2, 3, 4)
+x = ParRange 0 to 4
+y = ParRange 0 to 4
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3)
-y = ParRange(0, 1, 2, 3)
+x = ParRange 0 until 4
+y = ParRange 0 until 4
x equals y: true, y equals x: true
x = ParMap(5 -> 1, 10 -> 2)
diff --git a/test/files/pos/t6734.scala b/test/files/pos/t6734.scala
new file mode 100644
index 0000000000..88932cd2cc
--- /dev/null
+++ b/test/files/pos/t6734.scala
@@ -0,0 +1,17 @@
+
+// desugars to package p { object `package` }
+// previously, synthetic p.C was incorrectly added to this tree
+// This only matters because synthetics are not hygienic
+package object p
+
+package p {
+ import scala.concurrent.Future
+ case class C private[p] (value: Future[Int]) // private to avoid rewriting C.apply to new C
+}
+
+package client {
+ trait X {
+ import scala.concurrent.Future
+ def f = p.C(Future(42)(null)) // ensure synthetics were generated, i.e., p.C.apply
+ }
+}
diff --git a/test/files/pos/t6978.flags b/test/files/pos/t6978.flags
new file mode 100644
index 0000000000..7949c2afa2
--- /dev/null
+++ b/test/files/pos/t6978.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/test/files/pos/t6978/J.java b/test/files/pos/t6978/J.java
new file mode 100644
index 0000000000..1b9029ce53
--- /dev/null
+++ b/test/files/pos/t6978/J.java
@@ -0,0 +1,5 @@
+
+public class J {
+ public int f() { return 42; }
+}
+
diff --git a/test/files/pos/t6978/S.scala b/test/files/pos/t6978/S.scala
new file mode 100644
index 0000000000..41897db5ac
--- /dev/null
+++ b/test/files/pos/t6978/S.scala
@@ -0,0 +1,7 @@
+
+trait X { def f: Int }
+
+object Test extends J with X with App {
+ println(f)
+}
+
diff --git a/test/files/run/t10032.check b/test/files/run/t10032.check
new file mode 100644
index 0000000000..565fe25848
--- /dev/null
+++ b/test/files/run/t10032.check
@@ -0,0 +1,82 @@
+t1
+ i1
+ a1
+t2
+ i1
+ a1
+ a2
+ a3
+t3
+ i1
+ a1
+ a3
+t3
+ e1
+ a1
+ i2
+ a2
+ a3
+t4
+ i1
+ i2
+t4
+ e1
+ i2
+t5
+ i1
+ a1
+ a3
+t5
+ e1
+ a1
+ i2
+ a3
+t6
+ i1
+ i2
+ i3
+t6
+ e1
+ i2
+ i3
+t7
+ i1
+ a1
+t7
+ e1
+ i2
+ a1
+t8
+ i1
+ i2
+ a1
+ a2
+t8
+ e1
+ i2
+ a1
+ a2
+t9
+ i1
+ i2
+ a1
+t9
+ e1
+ i2
+ a1
+t10
+ i1
+ i2
+ i3
+t10
+ e1
+ i2
+ i3
+t11
+ i1
+ i2
+ a1
+t11
+ e1
+ i2
+ a1
diff --git a/test/files/run/t10032.scala b/test/files/run/t10032.scala
new file mode 100644
index 0000000000..f7e8ef459f
--- /dev/null
+++ b/test/files/run/t10032.scala
@@ -0,0 +1,164 @@
+object Test extends App {
+ def a1(): Unit = println(" a1")
+ def a2(): Unit = println(" a2")
+ def a3(): Unit = println(" a3")
+
+ def i1: Int = { println(" i1"); 1 }
+ def i2: Int = { println(" i2"); 2 }
+ def i3: Int = { println(" i3"); 3 }
+
+ def e1: Int = { println(" e1"); throw new Exception() }
+
+ def t1: Int = {
+ println("t1")
+ try {
+ synchronized { return i1 }
+ } finally {
+ synchronized { a1() }
+ }
+ }
+
+ def t2: Int = {
+ println("t2")
+ try {
+ try { return i1 }
+ finally { a1() }
+ } finally {
+ try { a2() }
+ finally { a3() }
+ }
+ }
+
+ def t3(i: => Int): Int = {
+ println("t3")
+ try {
+ try { return i }
+ finally { a1() }
+ } catch {
+ case _: Throwable =>
+ try { i2 }
+ finally { a2() } // no cleanup version
+ } finally {
+ a3()
+ }
+ }
+
+ def t4(i: => Int): Int = {
+ println("t4")
+ try {
+ return i
+ } finally {
+ return i2
+ }
+ }
+
+ def t5(i: => Int): Int = {
+ println("t5")
+ try {
+ try {
+ try { return i }
+ finally { a1() }
+ } catch {
+ case _: Throwable => i2
+ }
+ } finally {
+ a3()
+ }
+ }
+
+ def t6(i: => Int): Int = {
+ println("t6")
+ try {
+ try { return i }
+ finally { return i2 }
+ } finally {
+ return i3
+ }
+ }
+
+ def t7(i: => Int): Int = {
+ println("t7")
+ try { i }
+ catch {
+ case _: Throwable =>
+ return i2
+ } finally {
+ a1() // cleanup required, early return in handler
+ }
+ }
+
+ def t8(i: => Int): Int = {
+ println("t8")
+ try {
+ try { i }
+ finally { // no cleanup version
+ try { return i2 }
+ finally { a1() } // cleanup version required
+ }
+ } finally { // cleanup version required
+ a2()
+ }
+ }
+
+ def t9(i: => Int): Int = {
+ println("t9")
+ try {
+ return i
+ } finally {
+ try { return i2 }
+ finally { a1() }
+ }
+ }
+
+ def t10(i: => Int): Int = {
+ println("t10")
+ try {
+ return i
+ } finally {
+ try { return i2 }
+ finally { return i3 }
+ }
+ }
+
+ // this changed semantics between 2.12.0 and 2.12.1, see https://github.com/scala/scala/pull/5509#issuecomment-259291609
+ def t11(i: => Int): Int = {
+ println("t11")
+ try {
+ try { return i }
+ finally { return i2 }
+ } finally {
+ a1()
+ }
+ }
+
+ assert(t1 == 1)
+
+ assert(t2 == 1)
+
+ assert(t3(i1) == 1)
+ assert(t3(e1) == 2)
+
+ assert(t4(i1) == 2)
+ assert(t4(e1) == 2)
+
+ assert(t5(i1) == 1)
+ assert(t5(e1) == 2)
+
+ assert(t6(i1) == 3)
+ assert(t6(e1) == 3)
+
+ assert(t7(i1) == 1)
+ assert(t7(e1) == 2)
+
+ assert(t8(i1) == 2)
+ assert(t8(e1) == 2)
+
+ assert(t9(i1) == 2)
+ assert(t9(e1) == 2)
+
+ assert(t10(i1) == 3)
+ assert(t10(e1) == 3)
+
+ assert(t11(i1) == 2)
+ assert(t11(e1) == 2)
+}
diff --git a/test/files/run/t8433.check b/test/files/run/t8433.check
new file mode 100644
index 0000000000..9480ca51cb
--- /dev/null
+++ b/test/files/run/t8433.check
@@ -0,0 +1,2 @@
+high
+high
diff --git a/test/files/run/t8433.scala b/test/files/run/t8433.scala
new file mode 100644
index 0000000000..79e18757b8
--- /dev/null
+++ b/test/files/run/t8433.scala
@@ -0,0 +1,46 @@
+
+import tools.partest.DirectTest
+import reflect.internal.util._
+
+// mimic the resident compiler failure by recompiling
+// the class with new run of same global.
+object Test extends DirectTest {
+
+ override def code = """
+ object Main {
+ def main(args: Array[String]): Unit = {
+ Surf xmain args
+ import trial.core.Rankable
+ object Surf {
+ def xmain(args: Array[String]): Unit = println(new Strategy("win").rank)
+ }
+ class Strategy(name:String) extends Rankable
+ }
+ }
+ """
+
+ override def show(): Unit = {
+ // first, compile the interface
+ val dependency = """
+ |package trial
+ |
+ |object core {
+ | trait Rankable {
+ | val rank: String = "high"
+ | }
+ |}
+ |""".stripMargin
+
+ assert(compileString(newCompiler())(dependency))
+
+ // a resident global
+ val g = newCompiler()
+
+ assert(compileString(g)(code))
+ ScalaClassLoader(getClass.getClassLoader) run ("Main", Nil)
+ assert(compileString(g)(code))
+ ScalaClassLoader(getClass.getClassLoader) run ("Main", Nil)
+ }
+
+ override def extraSettings = s"-usejavacp -d ${testOutput.path}"
+}
diff --git a/test/files/run/t9375.scala b/test/files/run/t9375.scala
index 3995b38666..58893c963b 100644
--- a/test/files/run/t9375.scala
+++ b/test/files/run/t9375.scala
@@ -18,7 +18,7 @@ object SerDes {
import SerDes._
-// tests to make sure that de-serializing an object does not run its constructor
+// tests to make sure that deserializing an object does not run its constructor
trait S extends Serializable {
println(" konstruktor: " + this.getClass)
diff --git a/test/files/run/t9689.check b/test/files/run/t9689.check
new file mode 100644
index 0000000000..61ed6e13a2
--- /dev/null
+++ b/test/files/run/t9689.check
@@ -0,0 +1,14 @@
+
+scala> import bug._
+import bug._
+
+scala> import Wrap._
+import Wrap._
+
+scala> object Bar extends Foo
+defined object Bar
+
+scala> Bar.foo
+ok
+
+scala> :quit
diff --git a/test/files/run/t9689/Test_2.scala b/test/files/run/t9689/Test_2.scala
new file mode 100644
index 0000000000..086ddecdea
--- /dev/null
+++ b/test/files/run/t9689/Test_2.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+
+ def code = """
+import bug._
+import Wrap._
+object Bar extends Foo
+Bar.foo
+ """
+
+}
diff --git a/test/files/run/t9689/bug_1.scala b/test/files/run/t9689/bug_1.scala
new file mode 100644
index 0000000000..1dfd7bdad8
--- /dev/null
+++ b/test/files/run/t9689/bug_1.scala
@@ -0,0 +1,8 @@
+
+package bug
+
+object Wrap {
+ trait Foo {
+ def foo: Unit = println("ok")
+ }
+}
diff --git a/test/files/run/t9915/C_1.java b/test/files/run/t9915/C_1.java
new file mode 100644
index 0000000000..cbd52606be
--- /dev/null
+++ b/test/files/run/t9915/C_1.java
@@ -0,0 +1,18 @@
+
+public class C_1 {
+ public static final String NULLED = "X\000ABC";
+ public static final String SUPPED = "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖";
+
+ public String nulled() {
+ return C_1.NULLED;
+ }
+ public String supped() {
+ return C_1.SUPPED;
+ }
+ public int nulledSize() {
+ return C_1.NULLED.length();
+ }
+ public int suppedSize() {
+ return C_1.SUPPED.length();
+ }
+}
diff --git a/test/files/run/t9915/Test_2.scala b/test/files/run/t9915/Test_2.scala
new file mode 100644
index 0000000000..afed667cc6
--- /dev/null
+++ b/test/files/run/t9915/Test_2.scala
@@ -0,0 +1,12 @@
+
+object Test extends App {
+ val c = new C_1
+ assert(c.nulled == "X\u0000ABC") // "X\000ABC"
+ assert(c.supped == "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖")
+
+ assert(C_1.NULLED == "X\u0000ABC") // "X\000ABC"
+ assert(C_1.SUPPED == "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖")
+
+ assert(C_1.NULLED.size == "XYABC".size)
+ assert(C_1.SUPPED.codePointCount(0, C_1.SUPPED.length) == 8)
+}
diff --git a/test/junit/scala/collection/IteratorTest.scala b/test/junit/scala/collection/IteratorTest.scala
index 09061a3b29..1709e3c1bf 100644
--- a/test/junit/scala/collection/IteratorTest.scala
+++ b/test/junit/scala/collection/IteratorTest.scala
@@ -186,6 +186,12 @@ class IteratorTest {
assertEquals(1, y.next)
assertFalse(x.hasNext) // was true, after advancing underlying iterator
}
+ // SI-9913
+ @Test def `span leading iterator finishes at state -1`(): Unit = {
+ val (yes, no) = Iterator(1, 2, 3).span(_ => true)
+ assertFalse(no.hasNext)
+ assertTrue(yes.hasNext)
+ }
// SI-9623
@Test def noExcessiveHasNextInJoinIterator: Unit = {
var counter = 0
diff --git a/test/junit/scala/collection/parallel/immutable/ParRangeTest.scala b/test/junit/scala/collection/parallel/immutable/ParRangeTest.scala
new file mode 100644
index 0000000000..f746fc2bf9
--- /dev/null
+++ b/test/junit/scala/collection/parallel/immutable/ParRangeTest.scala
@@ -0,0 +1,15 @@
+package scala.collection.parallel.immutable
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Test
+
+@RunWith(classOf[JUnit4])
+class ParRangeTest {
+
+ @Test
+ def buildParRangeString {
+ assert(ParRange(1, 5, 1, true).toString == "ParRange 1 to 5")
+ }
+
+}