summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project/Build.scala6
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/page/Index.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala4
-rw-r--r--src/library/scala/collection/mutable/FlatHashTable.scala8
-rw-r--r--src/library/scala/collection/mutable/HashTable.scala20
-rw-r--r--test/files/run/t5804.check4
-rw-r--r--test/files/run/t5804.scala32
8 files changed, 60 insertions, 20 deletions
diff --git a/project/Build.scala b/project/Build.scala
index ea0e84f0cc..d3be8cd810 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -156,6 +156,8 @@ object ScalaBuild extends Build with Layers {
def settingOverrides: Seq[Setting[_]] = publishSettings ++ Seq(
crossPaths := false,
autoScalaLibrary := false,
+ // Work around a bug where scala-library (and forkjoin) is put on classpath for analysis.
+ classpathOptions := ClasspathOptions.manual,
publishArtifact in packageDoc := false,
publishArtifact in packageSrc := false,
target <<= (baseDirectory, name) apply (_ / "target" / _),
@@ -168,8 +170,8 @@ object ScalaBuild extends Build with Layers {
// Most libs in the compiler use this order to build.
compileOrder in Compile := CompileOrder.JavaThenScala,
lockFile <<= target(_ / "compile.lock"),
- skip in Compile <<= lockFile.map(_ exists),
- lock <<= lockFile map { f => IO.touch(f) },
+ skip in Compile <<= lockFile map (_.exists),
+ lock <<= lockFile map (f => IO.touch(f)),
unlock <<= lockFile map IO.delete
)
diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala
index f8fffdc726..8ed13e0da2 100644
--- a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala
@@ -44,7 +44,7 @@ class Index(universe: doc.Universe, index: doc.Index) extends HtmlPage {
</div>
{ browser }
<div id="content" class="ui-layout-center">
- <iframe id="template" src={ relativeLinkTo{List("package.html")} }/>
+ <iframe id="template" name="template" src={ relativeLinkTo{List("package.html")} }/>
</div>
</body>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 83be4a0b38..f4f081252f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -438,8 +438,8 @@ trait Contexts { self: Analyzer =>
def enclosingContextChain: List[Context] = this :: outer.enclosingContextChain
- override def toString = "Context(%s@%s unit=%s scope=%s errors=%b)".format(
- owner.fullName, tree.shortClass, unit, scope.##, hasErrors
+ override def toString = "Context(%s@%s unit=%s scope=%s errors=%b, reportErrors=%b, throwErrors=%b)".format(
+ owner.fullName, tree.shortClass, unit, scope.##, hasErrors, reportErrors, throwErrors
)
/** Is `sub` a subclass of `base` or a companion object of such a subclass?
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index 88e464a1f4..d1f319311e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -482,6 +482,10 @@ trait NamesDefaults { self: Analyzer =>
try typer.silent { tpr =>
val res = tpr.typed(arg, subst(paramtpe))
// better warning for SI-5044: if `silent` was not actually silent give a hint to the user
+ // [H]: the reason why `silent` is not silent is because the cyclic reference exception is
+ // thrown in a context completely different from `context` here. The exception happens while
+ // completing the type, and TypeCompleter is created/run with a non-silent Namer `context`
+ // and there is at the moment no way to connect the two unless we go through some global state.
if (errsBefore < reporter.ERROR.count)
WarnAfterNonSilentRecursiveInference(param, arg)(context)
res
diff --git a/src/library/scala/collection/mutable/FlatHashTable.scala b/src/library/scala/collection/mutable/FlatHashTable.scala
index ee6d4d1d22..4070174902 100644
--- a/src/library/scala/collection/mutable/FlatHashTable.scala
+++ b/src/library/scala/collection/mutable/FlatHashTable.scala
@@ -50,6 +50,10 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] {
protected def capacity(expectedSize: Int) = if (expectedSize == 0) 1 else powerOfTwo(expectedSize)
+ /** The initial size of the hash table.
+ */
+ def initialSize: Int = 32
+
private def initialCapacity = capacity(initialSize)
protected def randomSeed = seedGenerator.get.nextInt()
@@ -361,10 +365,6 @@ private[collection] object FlatHashTable {
def defaultLoadFactor: Int = 450
final def loadFactorDenum = 1000
- /** The initial size of the hash table.
- */
- def initialSize: Int = 32
-
def sizeForThreshold(size: Int, _loadFactor: Int) = math.max(32, (size.toLong * loadFactorDenum / _loadFactor).toInt)
def newThreshold(_loadFactor: Int, size: Int) = {
diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala
index a2f78dbde9..c307e6dcab 100644
--- a/src/library/scala/collection/mutable/HashTable.scala
+++ b/src/library/scala/collection/mutable/HashTable.scala
@@ -56,7 +56,15 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
protected def tableSizeSeed = Integer.bitCount(table.length - 1)
- protected def initialSize: Int = HashTable.initialSize
+ /** The initial size of the hash table.
+ */
+ protected def initialSize: Int = 16
+
+ /** The initial threshold.
+ */
+ private def initialThreshold(_loadFactor: Int): Int = newThreshold(_loadFactor, initialCapacity)
+
+ private def initialCapacity = capacity(initialSize)
private def lastPopulatedIndex = {
var idx = table.length - 1
@@ -354,16 +362,6 @@ private[collection] object HashTable {
private[collection] final def defaultLoadFactor: Int = 750 // corresponds to 75%
private[collection] final def loadFactorDenum = 1000;
- /** The initial size of the hash table.
- */
- private[collection] final def initialSize: Int = 16
-
- /** The initial threshold.
- */
- private[collection] final def initialThreshold(_loadFactor: Int): Int = newThreshold(_loadFactor, initialCapacity)
-
- private[collection] final def initialCapacity = capacity(initialSize)
-
private[collection] final def newThreshold(_loadFactor: Int, size: Int) = ((size.toLong * _loadFactor) / loadFactorDenum).toInt
private[collection] final def sizeForThreshold(_loadFactor: Int, thr: Int) = ((thr.toLong * loadFactorDenum) / _loadFactor).toInt
diff --git a/test/files/run/t5804.check b/test/files/run/t5804.check
new file mode 100644
index 0000000000..3ccc1c24d3
--- /dev/null
+++ b/test/files/run/t5804.check
@@ -0,0 +1,4 @@
+128
+16
+128
+32 \ No newline at end of file
diff --git a/test/files/run/t5804.scala b/test/files/run/t5804.scala
new file mode 100644
index 0000000000..b96a736035
--- /dev/null
+++ b/test/files/run/t5804.scala
@@ -0,0 +1,32 @@
+
+
+import collection.mutable._
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ class CustomHashMap extends HashMap[Int, Int] {
+ override def initialSize = 65
+
+ println(table.length)
+ }
+
+ new CustomHashMap
+ new HashMap {
+ println(table.length)
+ }
+
+ class CustomHashSet extends HashSet[Int] {
+ override def initialSize = 96
+
+ println(table.length)
+ }
+
+ new CustomHashSet
+ new HashSet {
+ println(table.length)
+ }
+ }
+
+}