Skip to content

Commit 9be8c41

Browse files
authored
Merge pull request scala/scala#7009 from lrytz/merge-2.12-to-2.13-aug-7
Merge 2.12 to 2.13 aug 7 [ci: last-only]
2 parents 4973209 + 48fd5ba commit 9be8c41

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

library/src/scala/Enumeration.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ import scala.util.matching.Regex
2727
* `Value` type member of the enumeration (`Value` selected on the stable
2828
* identifier path of the enumeration instance).
2929
*
30+
* Values SHOULD NOT be added to an enumeration after its construction;
31+
* doing so makes the enumeration thread-unsafe. If values are added to an
32+
* enumeration from multiple threads (in a non-synchronized fashion) after
33+
* construction, the behavior of the enumeration is undefined.
34+
*
3035
* @example {{{
3136
* // Define a new enumeration with a type alias and work with the full set of enumerated values
3237
* object WeekDay extends Enumeration {

library/src/scala/collection/immutable/HashMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ object HashMap extends MapFactory[HashMap] {
312312
protected def merge0[V1 >: V](that: HashMap[K, V1], level: Int, merger: Merger[K, V1]): HashMap[K, V1] = {
313313
// this can be made more efficient by passing the entire ListMap at once
314314
var m = that
315-
for (p <- kvs) m = m.updated0(p._1, this.hash, level, p._2, p, merger)
315+
for (p <- kvs) m = m.updated0(p._1, this.hash, level, p._2, p, merger.invert)
316316
m
317317
}
318318

library/src/scala/collection/mutable/ArrayBuilder.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ object ArrayBuilder {
9898
protected var elems: Array[T] = _
9999

100100
private def mkArray(size: Int): Array[T] = {
101-
val newelems = new Array[T](size)
102-
if (this.size > 0) Array.copy(elems, 0, newelems, 0, this.size)
103-
newelems
101+
if (capacity == size && capacity > 0) elems
102+
else if (elems eq null) new Array[T](size)
103+
else java.util.Arrays.copyOf[T](elems, size)
104104
}
105105

106106
protected[this] def resize(size: Int): Unit = {

0 commit comments

Comments
 (0)