summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.sbt19
-rw-r--r--project/Osgi.scala1
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/Logic.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala18
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala2
-rw-r--r--src/library/scala/Byte.scala8
-rw-r--r--src/library/scala/Char.scala8
-rw-r--r--src/library/scala/Int.scala8
-rw-r--r--src/library/scala/Long.scala8
-rw-r--r--src/library/scala/Short.scala8
-rw-r--r--src/library/scala/collection/JavaConverters.scala5
-rw-r--r--src/library/scala/collection/Searching.scala12
-rw-r--r--src/library/scala/collection/convert/DecorateAsJava.scala12
-rw-r--r--src/library/scala/collection/immutable/Vector.scala4
-rw-r--r--src/library/scala/concurrent/duration/Duration.scala4
-rw-r--r--src/library/scala/math/package.scala12
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/diagram/DiagramFactory.scala2
-rw-r--r--test/files/jvm/innerClassEnclMethodJavaReflection.scala9
-rw-r--r--test/files/presentation/doc/doc.scala6
-rw-r--r--test/files/run/t9567.scala18
-rw-r--r--test/files/run/t9567b.scala19
-rw-r--r--test/files/run/t9567c.scala29
-rw-r--r--test/junit/scala/collection/SearchingTest.scala48
-rw-r--r--test/junit/scala/collection/immutable/VectorTest.scala30
-rwxr-xr-xtools/scaladoc-diff117
-rw-r--r--versions.properties2
31 files changed, 365 insertions, 60 deletions
diff --git a/build.sbt b/build.sbt
index fb5849a2d1..8f0071049b 100644
--- a/build.sbt
+++ b/build.sbt
@@ -64,7 +64,7 @@ val scalaParserCombinatorsDep = withoutScalaLang("org.scala-lang.modules" %% "sc
val scalaSwingDep = withoutScalaLang("org.scala-lang.modules" %% "scala-swing" % versionNumber("scala-swing"))
val scalaXmlDep = withoutScalaLang("org.scala-lang.modules" %% "scala-xml" % versionNumber("scala-xml"))
val partestDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest" % versionNumber("partest"))
-val partestInterfaceDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest-interface" % "0.5.0")
+val partestInterfaceDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest-interface" % "0.7.0")
val junitDep = "junit" % "junit" % "4.11"
val junitIntefaceDep = "com.novocode" % "junit-interface" % "0.11" % "test"
val asmDep = "org.scala-lang.modules" % "scala-asm" % versionProps("scala-asm.version")
@@ -524,8 +524,8 @@ lazy val test = project
.settings(
publishArtifact := false,
libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, partestInterfaceDep, scalacheckDep),
- unmanagedBase in Test := baseDirectory.value / "files" / "lib",
- unmanagedJars in Test <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
+ unmanagedBase in IntegrationTest := baseDirectory.value / "files" / "lib",
+ unmanagedJars in IntegrationTest <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
// no main sources
sources in Compile := Seq.empty,
// test sources are compiled in partest run, not here
@@ -534,6 +534,7 @@ lazy val test = project
javaOptions in IntegrationTest += "-Xmx1G",
testFrameworks += new TestFramework("scala.tools.partest.Framework"),
testOptions in IntegrationTest += Tests.Setup( () => root.base.getAbsolutePath + "/pull-binary-libs.sh" ! ),
+ testOptions in IntegrationTest += Tests.Argument("-Dpartest.java_opts=-Xmx1024M -Xms64M -XX:MaxPermSize=128M"),
definedTests in IntegrationTest += (
new sbt.TestDefinition(
"partest",
@@ -637,8 +638,14 @@ lazy val dist = (project in file("dist"))
.settings(
libraryDependencies ++= Seq(scalaSwingDep, jlineDep),
mkBin := mkBinImpl.value,
- mkQuick <<= Def.task {} dependsOn ((distDependencies.map(products in Runtime in _) :+ mkBin): _*),
- mkPack <<= Def.task {} dependsOn (packageBin in Compile, mkBin),
+ 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)
+ } dependsOn ((distDependencies.map(products in Runtime in _) :+ mkBin): _*),
+ mkPack <<= Def.task {} dependsOn (packagedArtifact in (Compile, packageBin), mkBin),
target := (baseDirectory in ThisBuild).value / "target" / thisProject.value.id,
packageBin in Compile := {
val extraDeps = Set(scalaSwingDep, scalaParserCombinatorsDep, scalaXmlDep)
@@ -655,7 +662,7 @@ lazy val dist = (project in file("dist"))
},
cleanFiles += (buildDirectory in ThisBuild).value / "quick",
cleanFiles += (buildDirectory in ThisBuild).value / "pack",
- packageBin in Compile <<= (packageBin in Compile).dependsOn(distDependencies.map(packageBin in Compile in _): _*)
+ packagedArtifact in (Compile, packageBin) <<= (packagedArtifact in (Compile, packageBin)).dependsOn(distDependencies.map(packagedArtifact in (Compile, packageBin) in _): _*)
)
.dependsOn(distDependencies.map(p => p: ClasspathDep[ProjectReference]): _*)
diff --git a/project/Osgi.scala b/project/Osgi.scala
index 78370b695b..4676119076 100644
--- a/project/Osgi.scala
+++ b/project/Osgi.scala
@@ -63,6 +63,7 @@ object Osgi {
val jar = synchronized { builder.build }
builder.getWarnings.foreach(s => log.warn(s"bnd: $s"))
builder.getErrors.foreach(s => log.error(s"bnd: $s"))
+ IO.createDirectory(artifactPath.getParentFile)
jar.write(artifactPath)
artifactPath
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala
index ff36f36589..9a90c53d3e 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala
@@ -125,7 +125,7 @@ object BytecodeUtils {
}
def sameTargetExecutableInstruction(a: JumpInsnNode, b: JumpInsnNode): Boolean = {
- // Compare next executable instead of the the labels. Identifies a, b as the same target:
+ // Compare next executable instead of the labels. Identifies a, b as the same target:
// LabelNode(a)
// LabelNode(b)
// Instr
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index f7a1f462b7..7cd05b56c3 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -651,7 +651,7 @@ abstract class UnCurry extends InfoTransform
* This transformation erases the dependent method types by:
* - Widening the formal parameter type to existentially abstract
* over the prior parameters (using `packSymbols`). This transformation
- * is performed in the the `InfoTransform`er [[scala.reflect.internal.transform.UnCurry]].
+ * is performed in the `InfoTransform`er [[scala.reflect.internal.transform.UnCurry]].
* - Inserting casts in the method body to cast to the original,
* precise type.
*
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
index 8b2e09495f..4ae97ce281 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
@@ -542,7 +542,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis {
*
* (0) A or B must be in the domain to draw any conclusions.
*
- * For example, knowing the the scrutinee is *not* true does not
+ * For example, knowing the scrutinee is *not* true does not
* statically exclude it from being `X`, because that is an opaque
* Boolean.
*
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
index 96a20ea631..e12b8548a8 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
@@ -503,14 +503,26 @@ trait MatchTranslation {
*/
def treeMaker(binder: Symbol, binderKnownNonNull: Boolean, pos: Position): TreeMaker = {
val paramAccessors = binder.constrParamAccessors
+ val numParams = paramAccessors.length
+ def paramAccessorAt(subPatIndex: Int) = paramAccessors(math.min(subPatIndex, numParams - 1))
// binders corresponding to mutable fields should be stored (SI-5158, SI-6070)
// make an exception for classes under the scala package as they should be well-behaved,
// to optimize matching on List
+ val hasRepeated = paramAccessors.lastOption match {
+ case Some(x) => definitions.isRepeated(x)
+ case _ => false
+ }
val mutableBinders = (
if (!binder.info.typeSymbol.hasTransOwner(ScalaPackageClass) &&
- (paramAccessors exists (_.isMutable)))
- subPatBinders.zipWithIndex.collect{ case (binder, idx) if paramAccessors(idx).isMutable => binder }
- else Nil
+ (paramAccessors exists (x => x.isMutable || definitions.isRepeated(x)))) {
+
+ subPatBinders.zipWithIndex.flatMap {
+ case (binder, idx) =>
+ val param = paramAccessorAt(idx)
+ if (param.isMutable || (definitions.isRepeated(param) && !aligner.isStar)) binder :: Nil
+ else Nil
+ }
+ } else Nil
)
// checks binder ne null before chaining to the next extractor
diff --git a/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala b/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala
index 0574869714..9898cfd785 100644
--- a/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala
@@ -65,7 +65,7 @@ trait AnalyzerPlugins { self: Analyzer =>
* The hooks into `typeSig` allow analyzer plugins to add annotations to (or change the types
* of) definition symbols. This cannot not be achieved by using `pluginsTyped`: this method
* is only called during type checking, so changing the type of a symbol at this point is too
- * late: references to the symbol might already be typed and therefore obtain the the original
+ * late: references to the symbol might already be typed and therefore obtain the original
* type assigned during naming.
*
* @param defTree is the definition for which the type was computed. The different cases are
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
index a702b3cdf5..f90e61ff92 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
@@ -79,7 +79,7 @@ trait PatternTypers {
// do not update the symbol if the tree's symbol's type does not define an unapply member
// (e.g. since it's some method that returns an object with an unapply member)
val fun = inPlaceAdHocOverloadingResolution(fun0)(hasUnapplyMember)
- val caseClass = fun.tpe.typeSymbol.linkedClassOfClass
+ val caseClass = companionSymbolOf(fun.tpe.typeSymbol.sourceModule, context)
val member = unapplyMember(fun.tpe)
def resultType = (fun.tpe memberType member).finalResultType
def isEmptyType = resultOfMatchingMethod(resultType, nme.isEmpty)()
diff --git a/src/library/scala/Byte.scala b/src/library/scala/Byte.scala
index 413231c0d1..fb662911b3 100644
--- a/src/library/scala/Byte.scala
+++ b/src/library/scala/Byte.scala
@@ -79,8 +79,8 @@ final abstract class Byte private extends AnyVal {
*/
def >>>(x: Long): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
@@ -90,8 +90,8 @@ final abstract class Byte private extends AnyVal {
*/
def >>(x: Int): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
diff --git a/src/library/scala/Char.scala b/src/library/scala/Char.scala
index ec2d48c181..9f06503569 100644
--- a/src/library/scala/Char.scala
+++ b/src/library/scala/Char.scala
@@ -79,8 +79,8 @@ final abstract class Char private extends AnyVal {
*/
def >>>(x: Long): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
@@ -90,8 +90,8 @@ final abstract class Char private extends AnyVal {
*/
def >>(x: Int): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
diff --git a/src/library/scala/Int.scala b/src/library/scala/Int.scala
index 72e5ebf81b..3bd3775eba 100644
--- a/src/library/scala/Int.scala
+++ b/src/library/scala/Int.scala
@@ -79,8 +79,8 @@ final abstract class Int private extends AnyVal {
*/
def >>>(x: Long): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
@@ -90,8 +90,8 @@ final abstract class Int private extends AnyVal {
*/
def >>(x: Int): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
diff --git a/src/library/scala/Long.scala b/src/library/scala/Long.scala
index 1bd0fe88b1..b27a66647f 100644
--- a/src/library/scala/Long.scala
+++ b/src/library/scala/Long.scala
@@ -79,8 +79,8 @@ final abstract class Long private extends AnyVal {
*/
def >>>(x: Long): Long
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
@@ -90,8 +90,8 @@ final abstract class Long private extends AnyVal {
*/
def >>(x: Int): Long
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
diff --git a/src/library/scala/Short.scala b/src/library/scala/Short.scala
index 36b9ec4df9..2cbbf3cc59 100644
--- a/src/library/scala/Short.scala
+++ b/src/library/scala/Short.scala
@@ -79,8 +79,8 @@ final abstract class Short private extends AnyVal {
*/
def >>>(x: Long): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
@@ -90,8 +90,8 @@ final abstract class Short private extends AnyVal {
*/
def >>(x: Int): Int
/**
- * Returns this value bit-shifted left by the specified number of bits,
- * filling in the right bits with the same value as the left-most bit of this.
+ * Returns this value bit-shifted right by the specified number of bits,
+ * filling in the left bits with the same value as the left-most bit of this.
* The effect of this is to retain the sign of the value.
* @example {{{
* -21 >> 3 == -3
diff --git a/src/library/scala/collection/JavaConverters.scala b/src/library/scala/collection/JavaConverters.scala
index 875f6e1c02..86e86d4584 100644
--- a/src/library/scala/collection/JavaConverters.scala
+++ b/src/library/scala/collection/JavaConverters.scala
@@ -52,7 +52,10 @@ import convert._
* - `scala.collection.Set` => `java.util.Set`
* - `scala.collection.Map` => `java.util.Map`
*
- * @author Martin Odersky
+ * The following one way conversion is provided via `asScala`:
+ *
+ * - `java.util.Properties` => `scala.collection.mutable.Map`
+ *
* @since 2.8.1
*/
object JavaConverters extends DecorateAsJava with DecorateAsScala
diff --git a/src/library/scala/collection/Searching.scala b/src/library/scala/collection/Searching.scala
index b68124b3f8..25e8b5e253 100644
--- a/src/library/scala/collection/Searching.scala
+++ b/src/library/scala/collection/Searching.scala
@@ -36,12 +36,12 @@ object Searching {
class SearchImpl[A, Repr](val coll: SeqLike[A, Repr]) {
/** Search the sorted sequence for a specific element. If the sequence is an
- * `IndexedSeq`, a binary search is used. Otherwise, a linear search is used.
+ * `IndexedSeqLike`, a binary search is used. Otherwise, a linear search is used.
*
* The sequence should be sorted with the same `Ordering` before calling; otherwise,
* the results are undefined.
*
- * @see [[scala.collection.IndexedSeq]]
+ * @see [[scala.collection.IndexedSeqLike]]
* @see [[scala.math.Ordering]]
* @see [[scala.collection.SeqLike]], method `sorted`
*
@@ -54,18 +54,18 @@ object Searching {
*/
final def search[B >: A](elem: B)(implicit ord: Ordering[B]): SearchResult =
coll match {
- case _: IndexedSeq[A] => binarySearch(elem, 0, coll.length)(ord)
+ case _: IndexedSeqLike[A, Repr] => binarySearch(elem, 0, coll.length)(ord)
case _ => linearSearch(coll.view, elem, 0)(ord)
}
/** Search within an interval in the sorted sequence for a specific element. If the
- * sequence is an IndexedSeq, a binary search is used. Otherwise, a linear search
+ * sequence is an `IndexedSeqLike`, a binary search is used. Otherwise, a linear search
* is used.
*
* The sequence should be sorted with the same `Ordering` before calling; otherwise,
* the results are undefined.
*
- * @see [[scala.collection.IndexedSeq]]
+ * @see [[scala.collection.IndexedSeqLike]]
* @see [[scala.math.Ordering]]
* @see [[scala.collection.SeqLike]], method `sorted`
*
@@ -81,7 +81,7 @@ object Searching {
final def search[B >: A](elem: B, from: Int, to: Int)
(implicit ord: Ordering[B]): SearchResult =
coll match {
- case _: IndexedSeq[A] => binarySearch(elem, from, to)(ord)
+ case _: IndexedSeqLike[A, Repr] => binarySearch(elem, from, to)(ord)
case _ => linearSearch(coll.view(from, to), elem, from)(ord)
}
diff --git a/src/library/scala/collection/convert/DecorateAsJava.scala b/src/library/scala/collection/convert/DecorateAsJava.scala
index 6658b6feea..e6aa5da067 100644
--- a/src/library/scala/collection/convert/DecorateAsJava.scala
+++ b/src/library/scala/collection/convert/DecorateAsJava.scala
@@ -16,7 +16,7 @@ import WrapAsJava._
import scala.language.implicitConversions
-/** A collection of decorators that allow to convert between
+/** A collection of decorators that allow converting between
* Scala and Java collections using `asScala` and `asJava` methods.
*
* The following conversions are supported via `asJava`, `asScala`
@@ -38,8 +38,8 @@ import scala.language.implicitConversions
* val sl2 : scala.collection.mutable.Buffer[Int] = jl.asScala
* assert(sl eq sl2)
* }}}
- * The following conversions also are supported, but the
- * direction Scala to Java is done my a more specifically named method:
+ * The following conversions are also supported, but the
+ * direction from Scala to Java is done by the more specifically named methods:
* `asJavaCollection`, `asJavaEnumeration`, `asJavaDictionary`.
*
* - `scala.collection.Iterable` <=> `java.util.Collection`
@@ -53,10 +53,12 @@ import scala.language.implicitConversions
* - `scala.collection.Set` => `java.util.Set`
* - `scala.collection.Map` => `java.util.Map`
*
- * @author Martin Odersky
+ * The following one way conversion is provided via `asScala`:
+ *
+ * - `java.util.Properties` => `scala.collection.mutable.Map`
+ *
* @since 2.8.1
*/
-
trait DecorateAsJava {
/**
* Adds an `asJava` method that implicitly converts a Scala `Iterator` to a
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index cd2d3f843b..5a9734a99e 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -156,7 +156,7 @@ override def companion: GenericCompanion[Vector] = Vector
override def take(n: Int): Vector[A] = {
if (n <= 0)
Vector.empty
- else if (startIndex + n < endIndex)
+ else if (startIndex < endIndex - n)
dropBack0(startIndex + n)
else
this
@@ -165,7 +165,7 @@ override def companion: GenericCompanion[Vector] = Vector
override def drop(n: Int): Vector[A] = {
if (n <= 0)
this
- else if (startIndex + n < endIndex)
+ else if (startIndex < endIndex - n)
dropFront0(startIndex + n)
else
Vector.empty
diff --git a/src/library/scala/concurrent/duration/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala
index 8b7d81d1c4..a905ef345c 100644
--- a/src/library/scala/concurrent/duration/Duration.scala
+++ b/src/library/scala/concurrent/duration/Duration.scala
@@ -94,7 +94,7 @@ object Duration {
timeUnitLabels flatMap { case (unit, names) => expandLabels(names) map (_ -> unit) } toMap
/**
- * Extract length and time unit out of a string, where the format must match the description for [[Duration$.apply(String):Duration apply(String)]].
+ * Extract length and time unit out of a string, where the format must match the description for [[Duration$.apply(s:String)* apply(String)]].
* The extractor will not match for malformed strings or non-finite durations.
*/
def unapply(s: String): Option[(Long, TimeUnit)] =
@@ -355,7 +355,7 @@ object Duration {
* - isomorphic to `java.lang.Double` when it comes to infinite or undefined values
*
* The conversion between Duration and Double is done using [[Duration.toUnit]] (with unit NANOSECONDS)
- * and [[Duration$.fromNanos(Double):Duration Duration.fromNanos(Double)]].
+ * and [[Duration$.fromNanos(nanos:Double)* Duration.fromNanos(Double)]]
*
* <h2>Ordering</h2>
*
diff --git a/src/library/scala/math/package.scala b/src/library/scala/math/package.scala
index b6593d6661..54c81ed613 100644
--- a/src/library/scala/math/package.scala
+++ b/src/library/scala/math/package.scala
@@ -58,7 +58,19 @@ package object math {
* logarithms.
*/
def exp(x: Double): Double = java.lang.Math.exp(x)
+
+ /** Returns the natural logarithm of a `double` value.
+ *
+ * @param x the number to take the natural logarithm of
+ * @return the value `logₑ(x)` where `e` is Eulers number
+ */
def log(x: Double): Double = java.lang.Math.log(x)
+
+ /** Returns the square root of a `double` value.
+ *
+ * @param x the number to take the square root of
+ * @return the value √x
+ */
def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 65740e87f1..5b613316cc 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -56,7 +56,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
new FreeTypeSymbol(name, origin) initFlags flags
/**
- * This map stores the original owner the the first time the owner of a symbol is re-assigned.
+ * This map stores the original owner the first time the owner of a symbol is re-assigned.
* The original owner of a symbol is needed in some places in the backend. Ideally, owners should
* be versioned like the type history.
*/
@@ -503,7 +503,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
case _ => new StubTermSymbol(this, name.toTermName, missingMessage)
}
- /** Given a field, construct a term symbol that represents the source construct that gave rise the the field */
+ /** Given a field, construct a term symbol that represents the source construct that gave rise the field */
def sugaredSymbolOrSelf = {
val getter = getterIn(owner)
if (getter == NoSymbol) {
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
index 05724a879a..8fe1415d05 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
@@ -140,7 +140,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp
if (tpl.linearizationTemplates.isEmpty && tpl.conversions.isEmpty)
NodeSeq.Empty
else
- <li class="inherit out"><span>By inheritance</span></li>
+ <li class="inherit out"><span>By Inheritance</span></li>
}
</ol>
</div>
@@ -176,7 +176,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp
<span class="filtertype"></span>
<ol>
<li class="hideall out"><span>Hide All</span></li>
- <li class="showall in"><span>Show all</span></li>
+ <li class="showall in"><span>Show All</span></li>
</ol>
</div>
}
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/diagram/DiagramFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/diagram/DiagramFactory.scala
index 093899231e..86900f26c9 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/diagram/DiagramFactory.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/diagram/DiagramFactory.scala
@@ -248,7 +248,7 @@ trait DiagramFactory extends DiagramDirectiveParser {
case _ => Nil
})
- // Only show the the non-isolated nodes
+ // Only show the non-isolated nodes
// TODO: Decide if we really want to hide package members, I'm not sure that's a good idea (!!!)
// TODO: Does .distinct cause any stability issues?
val sourceNodes = edges.map(_._1)
diff --git a/test/files/jvm/innerClassEnclMethodJavaReflection.scala b/test/files/jvm/innerClassEnclMethodJavaReflection.scala
index a4d64d0b67..a60b5cac8e 100644
--- a/test/files/jvm/innerClassEnclMethodJavaReflection.scala
+++ b/test/files/jvm/innerClassEnclMethodJavaReflection.scala
@@ -25,12 +25,13 @@ object Test extends App {
def testClasses(jarOrDirectory: String): Unit = {
val classPath = AbstractFile.getDirectory(new java.io.File(jarOrDirectory))
+ val basePath = classPath.path + "/"
- def flatten(f: AbstractFile): Iterator[AbstractFile] =
- if (f.isClassContainer) f.iterator.flatMap(flatten)
- else Iterator(f)
+ def flatten(f: AbstractFile, s: String): Iterator[(AbstractFile, String)] =
+ if (f.isClassContainer) f.iterator.map(ch => (ch, (if(s.isEmpty) "" else s + "/") + ch.name)).flatMap((flatten _).tupled)
+ else Iterator((f, s))
- val classFullNames = flatten(classPath).filter(_.hasExtension("class")).map(_.path.replace("/", ".").replaceAll(".class$", ""))
+ val classFullNames = flatten(classPath, "").filter(_._1.hasExtension("class")).map(_._2.replace("/", ".").replaceAll(".class$", ""))
// it seems that Class objects can only be GC'd together with their class loader
// (http://stackoverflow.com/questions/2433261/when-and-how-are-classes-garbage-collected-in-java)
diff --git a/test/files/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala
index f2233f1828..ce431910ee 100644
--- a/test/files/presentation/doc/doc.scala
+++ b/test/files/presentation/doc/doc.scala
@@ -118,6 +118,12 @@ object Test extends InteractiveTest {
}
}
+ // The remainder of this test has been found to fail intermittently on Windows
+ // only. The problem is difficult to isolate and reproduce; see
+ // https://github.com/scala/scala-dev/issues/72 for details.
+ // So if we're on Windows, let's just bail out here.
+ if (scala.util.Properties.isWin) return
+
// Check inter-classes documentation one-time retrieved ok.
val baseSource = findSource("Base.scala")
val derivedSource = findSource("Derived.scala")
diff --git a/test/files/run/t9567.scala b/test/files/run/t9567.scala
new file mode 100644
index 0000000000..69896b8650
--- /dev/null
+++ b/test/files/run/t9567.scala
@@ -0,0 +1,18 @@
+object Test {
+ def testMethodLocalCaseClass {
+ case class MethodLocalWide(
+ f01: Int, f02: Int, f03: Int, f04: Int, f05: Int, f06: Int, f07: Int, f08: Int, f09: Int, f10: Int,
+ f11: Int, f12: Int, f13: Int, f14: Int, f15: Int, f16: Int, f17: Int, f18: Int, f19: Int, f20: Int,
+ f21: Int, f22: Int, f23: Int)
+
+ val instance = MethodLocalWide(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ val result = instance match {
+ case MethodLocalWide(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) => true
+ case _ => false
+ }
+ assert(result)
+ }
+ def main(args: Array[String]) {
+ testMethodLocalCaseClass
+ }
+}
diff --git a/test/files/run/t9567b.scala b/test/files/run/t9567b.scala
new file mode 100644
index 0000000000..88cef0a60e
--- /dev/null
+++ b/test/files/run/t9567b.scala
@@ -0,0 +1,19 @@
+object Test {
+ def testMethodLocalCaseClass {
+ object MethodLocalWide
+ case class MethodLocalWide(
+ f01: Int, f02: Int, f03: Int, f04: Int, f05: Int, f06: Int, f07: Int, f08: Int, f09: Int, f10: Int,
+ f11: Int, f12: Int, f13: Int, f14: Int, f15: Int, f16: Int, f17: Int, f18: Int, f19: Int, f20: Int,
+ f21: Int, f22: Int, f23: Int)
+
+ val instance = MethodLocalWide(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ val result = instance match {
+ case MethodLocalWide(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) => true
+ case _ => false
+ }
+ assert(result)
+ }
+ def main(args: Array[String]) {
+ testMethodLocalCaseClass
+ }
+}
diff --git a/test/files/run/t9567c.scala b/test/files/run/t9567c.scala
new file mode 100644
index 0000000000..560bea8821
--- /dev/null
+++ b/test/files/run/t9567c.scala
@@ -0,0 +1,29 @@
+case class CaseSequenceTopLevel(as: Int*)
+
+object Test {
+ def main(args: Array[String]): Unit = {
+
+ val buffer1 = collection.mutable.Buffer(0, 0)
+ CaseSequenceTopLevel(buffer1: _*) match {
+ case CaseSequenceTopLevel(_, i) =>
+ buffer1(1) = 1
+ assert(i == 0, i) // fails in 2.11.7 -optimize
+ }
+
+ case class CaseSequence(as: Int*)
+ val buffer2 = collection.mutable.Buffer(0, 0)
+ CaseSequence(buffer2: _*) match {
+ case CaseSequence(_, i) =>
+ buffer2(1) = 1
+ assert(i == 0, i)
+ }
+
+ case class CaseSequenceWithVar(var x: Any, as: Int*)
+ val buffer3 = collection.mutable.Buffer(0, 0)
+ CaseSequenceWithVar("", buffer3: _*) match {
+ case CaseSequenceWithVar(_, _, i) => // crashes in 2.11.7
+ buffer2(1) = 1
+ assert(i == 0, i)
+ }
+ }
+}
diff --git a/test/junit/scala/collection/SearchingTest.scala b/test/junit/scala/collection/SearchingTest.scala
new file mode 100644
index 0000000000..2f939d625e
--- /dev/null
+++ b/test/junit/scala/collection/SearchingTest.scala
@@ -0,0 +1,48 @@
+package scala.collection
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Assert._
+import org.junit.Test
+import scala.collection.Searching._
+
+@RunWith(classOf[JUnit4])
+class SearchingTest {
+
+ @Test
+ def doesLinearSearchOnLinearSeqs() {
+
+ class TestSeq[A](list: List[A]) extends SeqLike[A, TestSeq[A]] {
+ var elementsAccessed = Set.empty[Int]
+
+ protected[this] def newBuilder = ??? // not needed for this test
+ def seq = list
+ def iterator = list.iterator
+ def length = list.length
+ def apply(idx: Int) = { elementsAccessed += idx; list(idx) }
+ }
+
+ val coll = new TestSeq((0 to 6).toList)
+
+ assertEquals(Found(5), coll.search(5))
+ assertEquals(Set.empty, coll.elementsAccessed) // linear search should not access elements via apply()
+ }
+
+ @Test
+ def doesBinarySearchOnIndexedSeqs() {
+
+ class TestIndexedSeq[A](vec: Vector[A]) extends IndexedSeqLike[A, TestIndexedSeq[A]] {
+ var elementsAccessed = Set.empty[Int]
+
+ protected[this] def newBuilder = ??? // not needed for this test
+ def seq = vec
+ def length = vec.length
+ def apply(idx: Int) = { elementsAccessed += idx; vec(idx) }
+ }
+
+ val coll = new TestIndexedSeq((0 to 6).toVector)
+
+ assertEquals(Found(5), coll.search(5))
+ assertEquals(Set(3, 5), coll.elementsAccessed)
+ }
+}
diff --git a/test/junit/scala/collection/immutable/VectorTest.scala b/test/junit/scala/collection/immutable/VectorTest.scala
new file mode 100644
index 0000000000..69f74872d0
--- /dev/null
+++ b/test/junit/scala/collection/immutable/VectorTest.scala
@@ -0,0 +1,30 @@
+package scala.collection.immutable
+
+import org.junit.Assert._
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Test
+
+@RunWith(classOf[JUnit4])
+class VectorTest {
+
+ @Test
+ def hasCorrectDropAndTakeMethods() {
+ val v = Vector(0) ++ Vector(1 to 64: _*)
+
+ assertEquals(Vector(0, 1), v take 2)
+ assertEquals(Vector(63, 64), v takeRight 2)
+ assertEquals(Vector(2 to 64: _*), v drop 2)
+ assertEquals(Vector(0 to 62: _*), v dropRight 2)
+
+ assertEquals(v, v take Int.MaxValue)
+ assertEquals(v, v takeRight Int.MaxValue)
+ assertEquals(Vector.empty[Int], v drop Int.MaxValue)
+ assertEquals(Vector.empty[Int], v dropRight Int.MaxValue)
+
+ assertEquals(Vector.empty[Int], v take Int.MinValue)
+ assertEquals(Vector.empty[Int], v takeRight Int.MinValue)
+ assertEquals(v, v drop Int.MinValue)
+ assertEquals(v, v dropRight Int.MinValue)
+ }
+}
diff --git a/tools/scaladoc-diff b/tools/scaladoc-diff
new file mode 100755
index 0000000000..df0d1f3335
--- /dev/null
+++ b/tools/scaladoc-diff
@@ -0,0 +1,117 @@
+#!/usr/bin/env bash
+#
+# Script to compare the scaladoc of the current commit with the scaladoc
+# of the parent commit. No arguments.
+#
+
+set -e
+
+# opendiff for Mac OS X, meld for Ubuntu then default to other commands.
+displaydiff() {
+ case "$(uname -s)" in
+
+ Darwin)
+ if hash opendiff 2>/dev/null; then
+ echo opendiff "$@"
+ opendiff "$@"
+ else
+ echo diff "$@"
+ diff -y "$@" | less -N
+ fi
+ ;;
+
+ *)
+ if hash meld 2>/dev/null; then
+ echo meld "$@"
+ meld "$@"
+ elif hash gvimdiff 2>/dev/null; then
+ echo gvimdiff "$@"
+ gvimdiff "$@"
+ else
+ echo diff "$@"
+ diff -y "$@" | less -N
+ fi
+ ;;
+ esac
+}
+
+oldsha=$(git rev-parse --short HEAD^)
+
+# Use branch name defaulting to SHA1 when not available for example when in
+# detached HEAD state.
+sha=$(git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
+
+echo "parent commit sha : $oldsha"
+echo "current commit sha : $sha"
+
+# create scaladoc for parent commit if not done already
+if [ ! -f "build/scaladoc-output-$oldsha.txt" ]
+then
+ echo "making scaladoc for parent commit ($oldsha)"
+ git checkout -q $oldsha
+ ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$oldsha.txt
+ rm -rf build/scaladoc-${oldsha}
+ mv build/scaladoc build/scaladoc-${oldsha}
+ git checkout -q $sha
+fi
+
+# create scaladoc for current commit
+echo "making scaladoc for current commit ($sha)"
+ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$sha.txt
+rm -rf build/scaladoc-${sha}
+mv build/scaladoc build/scaladoc-${sha}
+
+# Allow script to continue when diff results in -1
+set +e
+
+displaydiff build/scaladoc-output-$oldsha.txt build/scaladoc-output-$sha.txt
+
+# Adapted from tools/scaladoc-compare
+echo "Comparing versions with diff: build/scaladoc-${sha}/ build/scaladoc-$oldsha/"
+NEW_PATH=build/scaladoc-${sha}/
+OLD_PATH=build/scaladoc-$oldsha/
+
+
+NEWFILES=$(find $NEW_PATH -name '*.html.raw')
+if [ "$NEWFILES" == "" ]
+then
+ echo "No .html.raw files found in $NEW_PATH!"
+ exit 1
+fi
+
+for NEW_FILE in $NEWFILES
+do
+ OLD_FILE=${NEW_FILE/$NEW_PATH/$OLD_PATH}
+ if [ -f $OLD_FILE ]
+ then
+ DIFF=$(diff -q -w $NEW_FILE $OLD_FILE 2>&1)
+ if [ "$DIFF" != "" ]
+ then
+ displaydiff $OLD_FILE $NEW_FILE > /dev/null
+
+ echo "next [y\N]? "
+ read -n 1 -s input
+ if [ "$input" == "N" ]; then exit 0; fi
+ fi
+ else
+ echo
+ echo "New file: : $NEW_FILE"
+ echo "No corresponding old file : $OLD_FILE"
+
+ echo "next [y\N]? "
+ read -n 1 -s input
+ if [ "$input" == "N" ]; then exit 0; fi
+ fi
+done
+
+OLDFILES=$(find $OLD_PATH -name '*.html.raw')
+for OLD_FILE in $OLDFILES
+do
+ NEW_FILE=${OLD_FILE/$OLD_PATH/$NEW_PATH}
+ if [ ! -f $NEW_FILE ]
+ then
+ echo
+ echo "Old file: : $OLD_FILE"
+ echo "No corresponding new file : $NEW_FILE"
+ fi
+done
diff --git a/versions.properties b/versions.properties
index e4c2a5b8e8..bb6d6d1038 100644
--- a/versions.properties
+++ b/versions.properties
@@ -30,7 +30,7 @@ jline.version=2.12.1
scala-asm.version=5.0.4-scala-3
# external modules, used internally (not shipped)
-partest.version.number=1.0.9
+partest.version.number=1.0.11
scalacheck.version.number=1.11.6
# TODO: modularize the compiler