Skip to content

Commit 682ed70

Browse files
committed
Fix growTable function for HashMap
When tranisitioning from dense to hashing, we grow the table more than usual since otherwise we'd have to grow it again at the very next addEntry. The condition for this was wrong for HashMaps.
1 parent 5db64c3 commit 682ed70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/util/GenericHashMap.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ abstract class GenericHashMap[Key, Value]
156156
protected def growTable(): Unit =
157157
val oldTable = table
158158
val newLength =
159-
if oldTable.length == DenseLimit then DenseLimit * 2 * roundToPower(capacityMultiple)
159+
if table.length == DenseLimit * 2 then table.length * roundToPower(capacityMultiple)
160160
else table.length
161161
allocate(newLength)
162162
copyFrom(oldTable)

0 commit comments

Comments
 (0)