File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -5577,11 +5577,11 @@ object Types {
5577
5577
}
5578
5578
5579
5579
class TypeSizeAccumulator (using Context ) extends TypeAccumulator [Int ] {
5580
- val seen = new java. util.IdentityHashMap [Type , Type ]
5580
+ var seen = util.HashSet [Type ](initialCapacity = 8 )
5581
5581
def apply (n : Int , tp : Type ): Int =
5582
- if ( seen.get (tp) != null ) n
5582
+ if seen.contains (tp) then n
5583
5583
else {
5584
- seen.put(tp, tp)
5584
+ seen += tp
5585
5585
tp match {
5586
5586
case tp : AppliedType =>
5587
5587
foldOver(n + 1 , tp)
@@ -5598,11 +5598,11 @@ object Types {
5598
5598
}
5599
5599
5600
5600
class CoveringSetAccumulator (using Context ) extends TypeAccumulator [Set [Symbol ]] {
5601
- val seen = new java. util.IdentityHashMap [Type , Type ]
5601
+ var seen = util.HashSet [Type ](initialCapacity = 8 )
5602
5602
def apply (cs : Set [Symbol ], tp : Type ): Set [Symbol ] =
5603
- if ( seen.get (tp) != null ) cs
5603
+ if seen.contains (tp) then cs
5604
5604
else {
5605
- seen.put(tp, tp)
5605
+ seen += tp
5606
5606
tp match {
5607
5607
case tp if tp.isTopType || tp.isBottomType =>
5608
5608
cs
Original file line number Diff line number Diff line change 1
1
package dotty .tools .dotc .util
2
2
import collection .immutable
3
3
4
- /** A linear identity set is a set that uses `eq` as the underlying
5
- * equality where after a `+` the previous set value cannot be used anymore.
6
- * The set is implemented as an immutable set for
7
- * sizes <= 4 and as a HashSet for larger sizes.
4
+ /** A linear set is a set here after a `+` the previous set value cannot be
5
+ * used anymore. The set is implemented as an immutable set for sizes <= 4
6
+ * and as a HashSet for larger sizes.
8
7
*/
9
8
opaque type LinearSet [Elem >: Null <: AnyRef ] =
10
9
immutable.Set [Elem ] | HashSet [Elem ]
You can’t perform that action at this time.
0 commit comments