Skip to content

Commit ccfbb63

Browse files
committed
FIx error in HashMap
1 parent 1faee3f commit ccfbb63

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ extends GenericHashMap[Key, Value](initialCapacity, capacityMultiple):
7171
setKey(idx, key)
7272
setValue(idx, value)
7373

74-
override def copyFrom(oldTable: Array[AnyRef]): Unit =
74+
override def copyFrom(oldTable: Array[AnyRef | Null]): Unit =
7575
if isDense then
7676
Array.copy(oldTable, 0, table, 0, oldTable.length)
7777
else

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

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ object GenericHashMap:
2525
* However, a table of size up to DenseLimit will be re-sized only
2626
* once the number of elements reaches the table's size.
2727
*/
28-
// TODO: Key be anyref?
2928
abstract class GenericHashMap[Key, Value]
3029
(initialCapacity: Int, capacityMultiple: Int) extends MutableMap[Key, Value]:
3130
import GenericHashMap.DenseLimit

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ extends GenericHashMap[Key, Value](initialCapacity, capacityMultiple):
7272
setKey(idx, key)
7373
setValue(idx, value)
7474

75-
override def copyFrom(oldTable: Array[AnyRef]): Unit =
75+
override def copyFrom(oldTable: Array[AnyRef | Null]): Unit =
7676
if isDense then
7777
Array.copy(oldTable, 0, table, 0, oldTable.length)
7878
else

0 commit comments

Comments
 (0)