Skip to content

Commit 3702fe9

Browse files
committed
use EqHashSet in extractDependencies
1 parent d20c624 commit 3702fe9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,12 @@ private class ExtractDependenciesCollector(rec: DependencyRecorder) extends tpd.
271271
// Avoid cycles by remembering both the types (testcase:
272272
// tests/run/enum-values.scala) and the symbols of named types (testcase:
273273
// tests/pos-java-interop/i13575) we've seen before.
274-
val seen = new util.HashSet[Symbol | Type](64)
275-
def traverse(tp: Type): Unit = if (!seen.contains(tp)) {
276-
seen += tp
274+
val seen = new util.EqHashSet[Symbol | Type](128) // 64 still needs to grow often for scala3-compiler
275+
def traverse(tp: Type): Unit = if seen.add(tp) then {
277276
tp match {
278277
case tp: NamedType =>
279278
val sym = tp.symbol
280-
if !seen.contains(sym) && !sym.is(Package) then
281-
seen += sym
279+
if !sym.is(Package) && seen.add(sym) then
282280
addDependency(sym)
283281
if !sym.isClass then traverse(tp.info)
284282
traverse(tp.prefix)

0 commit comments

Comments
 (0)