Skip to content

Commit b2f64b6

Browse files
committed
Fix StackOverflow in Names.rehash
Testing suite of specialization is creating huge amount of names, that triggered a StackOverflow in non-tail-recursive method. Not rehash is tail-recursive.
1 parent 74c2e23 commit b2f64b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dotty/tools/dotc/core/Names.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,11 @@ object Names {
268268
/** Rehash chain of names */
269269
def rehash(name: TermName): Unit =
270270
if (name != null) {
271-
rehash(name.next)
271+
val oldNext = name.next
272272
val h = hashValue(chrs, name.start, name.length) & (table.size - 1)
273273
name.next = table(h)
274274
table(h) = name
275+
rehash(oldNext)
275276
}
276277

277278
/** Make sure the hash table is large enough for the given load factor */

0 commit comments

Comments
 (0)