summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bincompat-forward.whitelist.conf5
-rwxr-xr-xbuild.xml12
-rwxr-xr-xsrc/compiler/scala/tools/ant/templates/tool-unix.tmpl39
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala1
-rw-r--r--src/library/scala/collection/SetLike.scala30
-rw-r--r--src/library/scala/collection/concurrent/TrieMap.scala38
-rw-r--r--src/library/scala/collection/mutable/MapLike.scala4
-rw-r--r--src/library/scala/reflect/ClassTag.scala39
-rw-r--r--src/library/scala/util/Random.scala10
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala10
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/Universe.scala3
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala21
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala14
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramGenerator.scala26
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala4
-rw-r--r--test/files/pos/t9116.scala7
-rw-r--r--test/files/pos/t9157.scala13
-rw-r--r--test/files/run/settings-parse.scala5
-rw-r--r--test/files/scalacheck/Ctrie.scala19
-rw-r--r--test/junit/scala/reflect/ClassTag.scala29
-rw-r--r--test/junit/scala/util/RandomTest.scala15
-rw-r--r--test/scaladoc/filters8
24 files changed, 247 insertions, 113 deletions
diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf
index 13e4f4ba85..3808083dd3 100644
--- a/bincompat-forward.whitelist.conf
+++ b/bincompat-forward.whitelist.conf
@@ -314,6 +314,11 @@ filter {
{
matchName="scala.reflect.runtime.Settings#IntSetting.valueSetByUser"
problemName=MissingMethodProblem
+ },
+ // SI-9059
+ {
+ matchName="scala.util.Random.scala$util$Random$$nextAlphaNum$1"
+ problemName=MissingMethodProblem
}
]
}
diff --git a/build.xml b/build.xml
index f8e44c6f5c..5f6b04b8e4 100755
--- a/build.xml
+++ b/build.xml
@@ -1445,15 +1445,7 @@ TODO:
<stopwatch name="quick.sbt-interface.timer" action="total"/>
</target>
- <target name="test.junit.init" depends="quick.done">
- <uptodate property="test.junit.available" targetfile="${build-junit.dir}/test-compile.complete">
- <srcfiles dir="${test.junit.src}">
- <include name="**/*.scala"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="test.junit.comp" depends="test.junit.init, quick.done" unless="test.junit.available">
+ <target name="test.junit.comp" depends="pack.done">
<stopwatch name="test.junit.compiler.timer"/>
<mkdir dir="${test.junit.classes}"/>
<scalacfork
@@ -1469,7 +1461,7 @@ TODO:
<stopwatch name="test.junit.compiler.timer" action="total"/>
</target>
- <target name="test.junit" depends="test.junit.comp, test.junit.init">
+ <target name="test.junit" depends="test.junit.comp">
<stopwatch name="test.junit.timer"/>
<mkdir dir="${test.junit.classes}"/>
<echo message="Note: details of failed tests will be output to ${build-junit.dir}"/>
diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
index 7acb3632d2..9862ea7987 100755
--- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
@@ -109,9 +109,6 @@ if [[ -n "$cygwin" ]]; then
JAVA_HOME="$(cygpath --$format "$JAVA_HOME")"
fi
TOOL_CLASSPATH="$(cygpath --path --$format "$TOOL_CLASSPATH")"
-elif [[ -n "$mingw" ]]; then
- SCALA_HOME="$(cmd //c echo "$SCALA_HOME")"
- TOOL_CLASSPATH="$(cmd //c echo "$TOOL_CLASSPATH")"
fi
if [[ -n "$cygwin$mingw" ]]; then
@@ -131,23 +128,6 @@ fi
declare -a java_args
declare -a scala_args
-# default to the boot classpath for speed, except on cygwin/mingw because
-# JLine on Windows requires a custom DLL to be loaded.
-unset usebootcp
-if [[ -z "$cygwin$mingw" ]]; then
- usebootcp="true"
-fi
-
-# If using the boot classpath, also pass an empty classpath
-# to java to suppress "." from materializing.
-classpathArgs () {
- if [[ -n $usebootcp ]]; then
- echo "-Xbootclasspath/a:$TOOL_CLASSPATH -classpath \"\""
- else
- echo "-classpath $TOOL_CLASSPATH"
- fi
-}
-
# SI-8358, SI-8368 -- the default should really be false,
# but I don't want to flip the default during 2.11's RC cycle
OVERRIDE_USEJAVACP="-Dscala.usejavacp=true"
@@ -200,6 +180,23 @@ if [[ -z "$JAVACMD" && -n "$JAVA_HOME" && -x "$JAVA_HOME/bin/java" ]]; then
JAVACMD="$JAVA_HOME/bin/java"
fi
+declare -a classpath_args
+
+# default to the boot classpath for speed, except on cygwin/mingw because
+# JLine on Windows requires a custom DLL to be loaded.
+unset usebootcp
+if [[ -z "$cygwin$mingw" ]]; then
+ usebootcp="true"
+fi
+
+# If using the boot classpath, also pass an empty classpath
+# to java to suppress "." from materializing.
+if [[ -n $usebootcp ]]; then
+ classpath_args=("-Xbootclasspath/a:$TOOL_CLASSPATH" -classpath "\"\"")
+else
+ classpath_args=(-classpath "$TOOL_CLASSPATH")
+fi
+
# note that variables which may intentionally be empty must not
# be quoted: otherwise an empty string will appear as a command line
# argument, and java will think that is the program to run.
@@ -207,7 +204,7 @@ execCommand \
"${JAVACMD:=java}" \
$JAVA_OPTS \
"${java_args[@@]}" \
- $(classpathArgs) \
+ "${classpath_args[@@]}" \
-Dscala.home="$SCALA_HOME" \
$OVERRIDE_USEJAVACP \
"$EMACS_OPT" \
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index 743bbe53bd..02356580cc 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -266,7 +266,6 @@ abstract class TreeCheckers extends Analyzer {
if (tree ne typed)
treesDiffer(tree, typed)
-
tree
}
diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala
index 3e549f72cd..f8ac1d754d 100644
--- a/src/library/scala/collection/SetLike.scala
+++ b/src/library/scala/collection/SetLike.scala
@@ -107,22 +107,36 @@ self =>
*/
def + (elem: A): This
- /** Creates a new $coll with additional elements.
+ /** Creates a new $coll with additional elements, omitting duplicates.
*
- * This method takes two or more elements to be added. Another overloaded
- * variant of this method handles the case where a single element is added.
+ * This method takes two or more elements to be added. Elements that already exist in the $coll will
+ * not be added. Another overloaded variant of this method handles the case where a single element is added.
+ *
+ * Example:
+ * {{{
+ * scala> val a = Set(1, 3) + 2 + 3
+ * a: scala.collection.immutable.Set[Int] = Set(1, 3, 2)
+ * }}}
*
* @param elem1 the first element to add.
* @param elem2 the second element to add.
* @param elems the remaining elements to add.
- * @return a new $coll with the given elements added.
+ * @return a new $coll with the given elements added, omitting duplicates.
*/
def + (elem1: A, elem2: A, elems: A*): This = this + elem1 + elem2 ++ elems
- /** Creates a new $coll by adding all elements contained in another collection to this $coll.
+ /** Creates a new $coll by adding all elements contained in another collection to this $coll, omitting duplicates.
+ *
+ * This method takes a collection of elements and adds all elements, omitting duplicates, into $coll.
+ *
+ * Example:
+ * {{{
+ * scala> val a = Set(1, 2) ++ Set(2, "a")
+ * a: scala.collection.immutable.Set[Any] = Set(1, 2, a)
+ * }}}
*
- * @param elems the collection containing the added elements.
- * @return a new $coll with the given elements added.
+ * @param elems the collection containing the elements to add.
+ * @return a new $coll with the given elements added, omitting duplicates.
*/
def ++ (elems: GenTraversableOnce[A]): This = (repr /: elems.seq)(_ + _)
@@ -171,7 +185,7 @@ self =>
*
* @return the iterator.
*/
- def subsets: Iterator[This] = new AbstractIterator[This] {
+ def subsets(): Iterator[This] = new AbstractIterator[This] {
private val elms = self.toIndexedSeq
private var len = 0
private var itr: Iterator[This] = Iterator.empty
diff --git a/src/library/scala/collection/concurrent/TrieMap.scala b/src/library/scala/collection/concurrent/TrieMap.scala
index fccc1d81b9..bcfea7a463 100644
--- a/src/library/scala/collection/concurrent/TrieMap.scala
+++ b/src/library/scala/collection/concurrent/TrieMap.scala
@@ -873,6 +873,44 @@ extends scala.collection.concurrent.Map[K, V]
insertifhc(k, hc, v, INode.KEY_ABSENT)
}
+ // TODO once computeIfAbsent is added to concurrent.Map,
+ // move the comment there and tweak the 'at most once' part
+ /** If the specified key is not already in the map, computes its value using
+ * the given thunk `op` and enters it into the map.
+ *
+ * Since concurrent maps cannot contain `null` for keys or values,
+ * a `NullPointerException` is thrown if the thunk `op`
+ * returns `null`.
+ *
+ * If the specified mapping function throws an exception,
+ * that exception is rethrown.
+ *
+ * Note: This method will invoke op at most once.
+ * However, `op` may be invoked without the result being added to the map if
+ * a concurrent process is also trying to add a value corresponding to the
+ * same key `k`.
+ *
+ * @param k the key to modify
+ * @param op the expression that computes the value
+ * @return the newly added value
+ */
+ override def getOrElseUpdate(k: K, op: =>V): V = {
+ val oldv = lookup(k)
+ if (oldv != null) oldv.asInstanceOf[V]
+ else {
+ val v = op
+ if (v == null) {
+ throw new NullPointerException("Concurrent TrieMap values cannot be null.")
+ } else {
+ val hc = computeHash(k)
+ insertifhc(k, hc, v, INode.KEY_ABSENT) match {
+ case Some(oldv) => oldv
+ case None => v
+ }
+ }
+ }
+ }
+
def remove(k: K, v: V): Boolean = {
val hc = computeHash(k)
removehc(k, v, hc).nonEmpty
diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala
index af28df1b88..44af886cf5 100644
--- a/src/library/scala/collection/mutable/MapLike.scala
+++ b/src/library/scala/collection/mutable/MapLike.scala
@@ -178,6 +178,10 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
*
* Otherwise, computes value from given expression `op`, stores with key
* in map and returns that value.
+ *
+ * Concurrent map implementations may evaluate the expression `op`
+ * multiple times, or may evaluate `op` without inserting the result.
+ *
* @param key the key to test
* @param op the computation yielding the value to associate with `key`, if
* `key` is previously unbound.
diff --git a/src/library/scala/reflect/ClassTag.scala b/src/library/scala/reflect/ClassTag.scala
index 2f4aa9cb84..9dd96183da 100644
--- a/src/library/scala/reflect/ClassTag.scala
+++ b/src/library/scala/reflect/ClassTag.scala
@@ -69,22 +69,22 @@ trait ClassTag[T] extends ClassManifestDeprecatedApis[T] with Equals with Serial
* `SomeExtractor(...)` is turned into `ct(SomeExtractor(...))` if `T` in `SomeExtractor.unapply(x: T)`
* is uncheckable, but we have an instance of `ClassTag[T]`.
*/
- def unapply(x: Any): Option[T] = x match {
- case null => None
- case b: Byte => unapply(b)
- case s: Short => unapply(s)
- case c: Char => unapply(c)
- case i: Int => unapply(i)
- case l: Long => unapply(l)
- case f: Float => unapply(f)
- case d: Double => unapply(d)
- case b: Boolean => unapply(b)
- case u: Unit => unapply(u)
- case a: Any => unapplyImpl(a)
- }
+ def unapply(x: Any): Option[T] =
+ if (null != x && (
+ (runtimeClass.isInstance(x))
+ || (x.isInstanceOf[Byte] && runtimeClass.isAssignableFrom(classOf[Byte]))
+ || (x.isInstanceOf[Short] && runtimeClass.isAssignableFrom(classOf[Short]))
+ || (x.isInstanceOf[Char] && runtimeClass.isAssignableFrom(classOf[Char]))
+ || (x.isInstanceOf[Int] && runtimeClass.isAssignableFrom(classOf[Int]))
+ || (x.isInstanceOf[Long] && runtimeClass.isAssignableFrom(classOf[Long]))
+ || (x.isInstanceOf[Float] && runtimeClass.isAssignableFrom(classOf[Float]))
+ || (x.isInstanceOf[Double] && runtimeClass.isAssignableFrom(classOf[Double]))
+ || (x.isInstanceOf[Boolean] && runtimeClass.isAssignableFrom(classOf[Boolean]))
+ || (x.isInstanceOf[Unit] && runtimeClass.isAssignableFrom(classOf[Unit])))
+ ) Some(x.asInstanceOf[T])
+ else None
- // TODO: Inline the bodies of these into the Any-accepting unapply overload above and delete them.
- // This cannot be done until at least 2.12.0 for reasons of binary compatibility
+ // TODO: deprecate overloads in 2.12.0, remove in 2.13.0
def unapply(x: Byte) : Option[T] = unapplyImpl(x, classOf[Byte])
def unapply(x: Short) : Option[T] = unapplyImpl(x, classOf[Short])
def unapply(x: Char) : Option[T] = unapplyImpl(x, classOf[Char])
@@ -94,11 +94,10 @@ trait ClassTag[T] extends ClassManifestDeprecatedApis[T] with Equals with Serial
def unapply(x: Double) : Option[T] = unapplyImpl(x, classOf[Double])
def unapply(x: Boolean) : Option[T] = unapplyImpl(x, classOf[Boolean])
def unapply(x: Unit) : Option[T] = unapplyImpl(x, classOf[Unit])
-
- private[this] def unapplyImpl(x: Any, alternative: jClass[_] = null): Option[T] = {
- val conforms = runtimeClass.isAssignableFrom(x.getClass) || (alternative != null && runtimeClass.isAssignableFrom(alternative))
- if (conforms) Some(x.asInstanceOf[T]) else None
- }
+
+ private[this] def unapplyImpl(x: Any, primitiveCls: java.lang.Class[_]): Option[T] =
+ if (runtimeClass.isInstance(x) || runtimeClass.isAssignableFrom(primitiveCls)) Some(x.asInstanceOf[T])
+ else None
// case class accessories
override def canEqual(x: Any) = x.isInstanceOf[ClassTag[_]]
diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala
index 8d68c5be38..2d38c9d4a0 100644
--- a/src/library/scala/util/Random.scala
+++ b/src/library/scala/util/Random.scala
@@ -121,15 +121,21 @@ class Random(val self: java.util.Random) extends AnyRef with Serializable {
(bf(xs) ++= buf).result()
}
+ @deprecated("Preserved for backwards binary compatibility. To remove in 2.12.x.", "2.11.6")
+ final def `scala$util$Random$$isAlphaNum$1`(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')
+
/** Returns a Stream of pseudorandomly chosen alphanumeric characters,
* equally chosen from A-Z, a-z, and 0-9.
*
* @since 2.8
*/
def alphanumeric: Stream[Char] = {
- def isAlphaNum(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')
+ def nextAlphaNum: Char = {
+ val chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+ chars charAt (self nextInt chars.length)
+ }
- Stream continually nextPrintableChar filter isAlphaNum
+ Stream continually nextAlphaNum
}
}
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index ce36f7efa3..8f114caac0 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -1976,13 +1976,13 @@ trait Types
* usage scenario.
*/
private var relativeInfoCache: Type = _
- private var memberInfoCache: Type = _
+ private var relativeInfoPeriod: Period = NoPeriod
- private[Types] def relativeInfo = {
- val memberInfo = pre.memberInfo(sym)
- if (relativeInfoCache == null || (memberInfo ne memberInfoCache)) {
- memberInfoCache = memberInfo
+ private[Types] def relativeInfo = /*trace(s"relativeInfo(${safeToString}})")*/{
+ if (relativeInfoPeriod != currentPeriod) {
+ val memberInfo = pre.memberInfo(sym)
relativeInfoCache = transformInfo(memberInfo)
+ relativeInfoPeriod = currentPeriod
}
relativeInfoCache
}
diff --git a/src/scaladoc/scala/tools/nsc/doc/Universe.scala b/src/scaladoc/scala/tools/nsc/doc/Universe.scala
index 11520c810e..edf5112d7b 100644
--- a/src/scaladoc/scala/tools/nsc/doc/Universe.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/Universe.scala
@@ -5,6 +5,8 @@
package scala.tools.nsc.doc
+import scala.tools.nsc.doc.html.page.diagram.DotRunner
+
/**
* Class to hold common dependencies across Scaladoc classes.
* @author Pedro Furlanetto
@@ -13,4 +15,5 @@ package scala.tools.nsc.doc
trait Universe {
def settings: Settings
def rootPackage: model.Package
+ def dotRunner: DotRunner
}
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala
index a0dd154d2e..61ab18d42d 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala
@@ -13,8 +13,6 @@ import io.{ Streamable, Directory }
import scala.collection._
import page.diagram._
-import html.page.diagram.DiagramGenerator
-
/** A class that can generate Scaladoc sites to some fixed root folder.
* @author David Bernard
* @author Gilles Dubochet */
@@ -121,28 +119,27 @@ class HtmlFactory(val universe: doc.Universe, index: doc.Index) {
finally out.close()
}
- DiagramGenerator.initialize(universe.settings)
-
libResources foreach (s => copyResource("lib/" + s))
new page.Index(universe, index) writeFor this
new page.IndexScript(universe, index) writeFor this
-
- writeTemplates(_ writeFor this)
-
- for (letter <- index.firstLetterIndex) {
- new html.page.ReferenceIndex(letter._1, index, universe) writeFor this
+ try {
+ writeTemplates(_ writeFor this)
+ for (letter <- index.firstLetterIndex) {
+ new html.page.ReferenceIndex(letter._1, index, universe) writeFor this
+ }
+ } finally {
+ DiagramStats.printStats(universe.settings)
+ universe.dotRunner.cleanup()
}
-
- DiagramGenerator.cleanup()
}
def writeTemplates(writeForThis: HtmlPage => Unit) {
val written = mutable.HashSet.empty[DocTemplateEntity]
- val diagramGenerator: DiagramGenerator = new DotDiagramGenerator(universe.settings)
def writeTemplate(tpl: DocTemplateEntity) {
if (!(written contains tpl)) {
+ val diagramGenerator: DiagramGenerator = new DotDiagramGenerator(universe.settings, universe.dotRunner)
writeForThis(new page.Template(universe, diagramGenerator, tpl))
written += tpl
tpl.templates collect { case d: DocTemplateEntity => d } map writeTemplate
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala
index 3738e79ffe..ce75749859 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala
@@ -227,6 +227,18 @@ abstract class HtmlPage extends Page { thisPage =>
<img src={ relativeLinkTo(List("permalink.png", "lib")) } />
</a>
</span>
+
+ def docEntityKindToCompanionTitle(ety: DocTemplateEntity, baseString: String = "See companion") =
+ ety.companion match{
+ case Some(companion) =>
+ s"$baseString${
+ if(companion.isObject) " object"
+ else if(companion.isTrait) " trait"
+ else if(companion.isClass) " class"
+ else ""
+ }"
+ case None => baseString
+ }
def companionAndPackage(tpl: DocTemplateEntity): Elem =
<span class="morelinks">{
@@ -238,7 +250,7 @@ abstract class HtmlPage extends Page { thisPage =>
else s"class ${companionTpl.name}"
<div>
Related Docs:
- <a href={relativeLinkTo(tpl.companion.get)} title="See companion">{objClassTrait}</a>
+ <a href={relativeLinkTo(tpl.companion.get)} title={docEntityKindToCompanionTitle(tpl)}>{objClassTrait}</a>
| {templateToHtml(tpl.inTemplate, s"package ${tpl.inTemplate.name}")}
</div>
case None =>
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 eda52c5fbf..e10c54a414 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
@@ -89,7 +89,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp
val templateName = if (tpl.isRootPackage) "root package" else tpl.name
val displayName = tpl.companion match {
case Some(companion) if (companion.visibility.isPublic && companion.inSource != None) =>
- <a href={relativeLinkTo(companion)} title="Go to companion">{ templateName }</a>
+ <a href={relativeLinkTo(companion)} title={docEntityKindToCompanionTitle(tpl)}>{ templateName }</a>
case _ =>
templateName
}
@@ -105,7 +105,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp
{
tpl.companion match {
case Some(companion) if (companion.visibility.isPublic && companion.inSource != None) =>
- <a href={relativeLinkTo(companion)} title="Go to companion"><img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/></a>
+ <a href={relativeLinkTo(companion)} title={docEntityKindToCompanionTitle(tpl)}><img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/></a>
case _ =>
<img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/>
}}
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramGenerator.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramGenerator.scala
index 61c1819d11..cf65de4151 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramGenerator.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DiagramGenerator.scala
@@ -25,29 +25,3 @@ trait DiagramGenerator {
*/
def generate(d: Diagram, t: DocTemplateEntity, p: HtmlPage):NodeSeq
}
-
-object DiagramGenerator {
-
- // TODO: This is tailored towards the dot generator, since it's the only generator. In the future it should be more
- // general.
-
- private[this] var dotRunner: DotRunner = null
- private[this] var settings: doc.Settings = null
-
- def initialize(s: doc.Settings) =
- settings = s
-
- def getDotRunner() = {
- if (dotRunner == null)
- dotRunner = new DotRunner(settings)
- dotRunner
- }
-
- def cleanup() = {
- DiagramStats.printStats(settings)
- if (dotRunner != null) {
- dotRunner.cleanup()
- dotRunner = null
- }
- }
-} \ No newline at end of file
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 4ff436bdc6..b541cf721b 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
@@ -15,7 +15,7 @@ import scala.collection.immutable._
import model._
import model.diagram._
-class DotDiagramGenerator(settings: doc.Settings) extends DiagramGenerator {
+class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends DiagramGenerator {
// the page where the diagram will be embedded
private var page: HtmlPage = null
@@ -317,7 +317,7 @@ class DotDiagramGenerator(settings: doc.Settings) extends DiagramGenerator {
* Calls dot with a given dot string and returns the SVG output.
*/
private def generateSVG(dotInput: String, template: DocTemplateEntity) = {
- val dotOutput = DiagramGenerator.getDotRunner().feedToDot(dotInput, template)
+ val dotOutput = dotRunner.feedToDot(dotInput, template)
var tSVG = -System.currentTimeMillis
val result = if (dotOutput != null) {
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
index 7289edc137..03d71f15a3 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -9,8 +9,11 @@ import base.comment._
import diagram._
import scala.collection._
+import scala.tools.nsc.doc.html.HtmlPage
+import scala.tools.nsc.doc.html.page.diagram.{DotRunner}
import scala.util.matching.Regex
import scala.reflect.macros.internal.macroImpl
+import scala.xml.NodeSeq
import symtab.Flags
import io._
@@ -47,6 +50,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
thisFactory.universe = thisUniverse
val settings = thisFactory.settings
val rootPackage = modelCreation.createRootPackage
+ lazy val dotRunner = new DotRunner(settings)
}
_modelFinished = true
// complete the links between model entities, everthing that couldn't have been done before
diff --git a/test/files/pos/t9116.scala b/test/files/pos/t9116.scala
new file mode 100644
index 0000000000..16b04c2e6b
--- /dev/null
+++ b/test/files/pos/t9116.scala
@@ -0,0 +1,7 @@
+
+trait X {
+ List(1, 2, 3).toSet.subsets.map(_.toList) // ok now
+
+ List(1, 2, 3).toSet.subsets().map(_.toList) // now also
+ List(1, 2, 3).toSet.subsets(2).map(_.toList) // still ok
+}
diff --git a/test/files/pos/t9157.scala b/test/files/pos/t9157.scala
new file mode 100644
index 0000000000..e178b5d84d
--- /dev/null
+++ b/test/files/pos/t9157.scala
@@ -0,0 +1,13 @@
+trait Flow[-In, +Out] {
+ type Repr[+O] <: Flow[In, O]
+ def map: Repr[String]
+}
+
+class Test {
+ // typechecking was exponentially slow wrt the number of projections here.
+ def slowFlow(
+ f: Flow[String,String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]
+ ) = {
+ f.map
+ }
+}
diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala
index 2754feb972..8d83caf68f 100644
--- a/test/files/run/settings-parse.scala
+++ b/test/files/run/settings-parse.scala
@@ -3,9 +3,8 @@ import scala.language.postfixOps
import scala.tools.nsc._
object Test {
- val tokens = List("", "-deprecation", "foo.scala")
- val subsets = tokens.toSet.subsets.toList
- val permutations0 = subsets.flatMap(_.toList.permutations).distinct
+ val tokens = "" :: "-deprecation" :: "foo.scala" :: Nil
+ val permutations0 = tokens.toSet.subsets.flatMap(_.toList.permutations).toList.distinct
def runWithCp(cp: String) = {
val permutations = permutations0 flatMap ("-cp CPTOKEN" :: _ permutations)
diff --git a/test/files/scalacheck/Ctrie.scala b/test/files/scalacheck/Ctrie.scala
index 714f1c3b09..eef9d06f37 100644
--- a/test/files/scalacheck/Ctrie.scala
+++ b/test/files/scalacheck/Ctrie.scala
@@ -186,6 +186,25 @@ object Test extends Properties("concurrent.TrieMap") {
})
}
+ property("concurrent getOrElseUpdate") = forAll(threadCounts, sizes) {
+ (p, sz) =>
+ val totalInserts = new java.util.concurrent.atomic.AtomicInteger
+ val ct = new TrieMap[Wrap, String]
+
+ val results = inParallel(p) {
+ idx =>
+ (0 until sz) foreach {
+ i =>
+ val v = ct.getOrElseUpdate(Wrap(i), idx + ":" + i)
+ if (v == idx + ":" + i) totalInserts.incrementAndGet()
+ }
+ }
+
+ (totalInserts.get == sz) && ((0 until sz) forall {
+ case i => ct(Wrap(i)).split(":")(1).toInt == i
+ })
+ }
+
}
diff --git a/test/junit/scala/reflect/ClassTag.scala b/test/junit/scala/reflect/ClassTag.scala
new file mode 100644
index 0000000000..90cc981fc1
--- /dev/null
+++ b/test/junit/scala/reflect/ClassTag.scala
@@ -0,0 +1,29 @@
+package scala.reflect
+
+import org.junit.Test
+import org.junit.Assert._
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+import scala.tools.testing.AssertUtil._
+
+class Misc
+
+@RunWith(classOf[JUnit4])
+class ClassTagTest {
+ def checkNotString[A: ClassTag](a: Any) = a match { case x: String => false case x: A => true case _ => false }
+ def checkNotInt[A: ClassTag](a: Any) = a match { case x: Int => false case x: A => true case _ => false }
+ def checkNotLong[A: ClassTag](a: Any) = a match { case x: Long => false case x: A => true case _ => false }
+
+ @Test def checkMisc = assertTrue(checkNotString[Misc](new Misc))
+ @Test def checkString = assertTrue(checkNotInt[String] ("woele"))
+ @Test def checkByte = assertTrue(checkNotInt[Byte] (0.toByte))
+ @Test def checkShort = assertTrue(checkNotInt[Short] (0.toShort))
+ @Test def checkChar = assertTrue(checkNotInt[Char] (0.toChar))
+ @Test def checkInt = assertTrue(checkNotLong[Int] (0.toInt))
+ @Test def checkLong = assertTrue(checkNotInt[Long] (0.toLong))
+ @Test def checkFloat = assertTrue(checkNotInt[Float] (0.toFloat))
+ @Test def checkDouble = assertTrue(checkNotInt[Double] (0.toDouble))
+ @Test def checkBoolean = assertTrue(checkNotInt[Boolean](false))
+ @Test def checkUnit = assertTrue(checkNotInt[Unit] ({}))
+} \ No newline at end of file
diff --git a/test/junit/scala/util/RandomTest.scala b/test/junit/scala/util/RandomTest.scala
new file mode 100644
index 0000000000..32959675ee
--- /dev/null
+++ b/test/junit/scala/util/RandomTest.scala
@@ -0,0 +1,15 @@
+package scala.util
+
+import org.junit.{ Assert, Test }
+
+class RandomTest {
+ // Test for SI-9059
+ @Test def testAlphanumeric: Unit = {
+ def isAlphaNum(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')
+
+ val items = Random.alphanumeric.take(100000)
+ for (c <- items) {
+ Assert.assertTrue(s"$c should be alphanumeric", isAlphaNum(c))
+ }
+ }
+}
diff --git a/test/scaladoc/filters b/test/scaladoc/filters
new file mode 100644
index 0000000000..51a7507848
--- /dev/null
+++ b/test/scaladoc/filters
@@ -0,0 +1,8 @@
+#
+#Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28).
+Java HotSpot\(TM\) .* warning:
+# Hotspot receiving VM options through the $_JAVA_OPTIONS
+# env variable outputs them on stderr
+Picked up _JAVA_OPTIONS:
+# Filter out a message caused by this bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8021205
+objc\[\d+\]: Class JavaLaunchHelper is implemented in both .* and .*\. One of the two will be used\. Which one is undefined\.