Skip to content

Commit fd7b60c

Browse files
felixmulderodersky
authored andcommitted
Fix stack overflow on recurs in namer
1 parent a75fee2 commit fd7b60c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ class Namer { typer: Typer =>
403403
/** Create top-level symbols for all statements in the expansion of this statement and
404404
* enter them into symbol table
405405
*/
406-
def indexExpanded(stat: Tree)(implicit ctx: Context): Context = {
407-
def recur(stat: Tree): Context = expanded(stat) match {
406+
def indexExpanded(origStat: Tree)(implicit ctx: Context): Context = {
407+
def recur(stat: Tree): Context = stat match {
408408
case pcl: PackageDef =>
409409
val pkg = createPackageSymbol(pcl.pid)
410410
index(pcl.stats)(ctx.fresh.setOwner(pkg.moduleClass))
@@ -415,7 +415,7 @@ class Namer { typer: Typer =>
415415
importContext(createSymbol(imp), imp.selectors)
416416
case mdef: DefTree =>
417417
val sym = enterSymbol(createSymbol(mdef))
418-
setDocstring(sym, stat)
418+
setDocstring(sym, origStat)
419419
addEnumConstants(mdef, sym)
420420
ctx
421421
case stats: Thicket =>
@@ -424,7 +424,7 @@ class Namer { typer: Typer =>
424424
case _ =>
425425
ctx
426426
}
427-
recur(stat)
427+
recur(expanded(origStat))
428428
}
429429

430430
/** Determines whether this field holds an enum constant.

0 commit comments

Comments
 (0)