@@ -530,28 +530,29 @@ class Namer { typer: Typer =>
530
530
* enter them into symbol table
531
531
*/
532
532
def indexExpanded (origStat : Tree )(using Context ): Context = {
533
- def recur (stat : Tree ): Context = stat match {
533
+ def recur (stat : Tree , idx : Int ): Context = stat match {
534
534
case pcl : PackageDef =>
535
535
val pkg = createPackageSymbol(pcl.pid)
536
536
index(pcl.stats)(using ctx.fresh.setOwner(pkg.moduleClass))
537
537
invalidateCompanions(pkg, Trees .flatten(pcl.stats map expanded))
538
- setDocstring(pkg, stat)
538
+ setDocstring(pkg, stat, idx )
539
539
ctx
540
540
case imp : Import =>
541
541
ctx.importContext(imp, createSymbol(imp))
542
542
case mdef : DefTree =>
543
543
val sym = createSymbol(mdef)
544
544
enterSymbol(sym)
545
- setDocstring(sym, origStat)
545
+ setDocstring(sym, origStat, idx )
546
546
addEnumConstants(mdef, sym)
547
547
ctx
548
548
case stats : Thicket =>
549
- stats.toList.foreach(recur)
549
+ for (stat, i) <- stats.toList.zipWithIndex do
550
+ recur(stat, i)
550
551
ctx
551
552
case _ =>
552
553
ctx
553
554
}
554
- recur(expanded(origStat))
555
+ recur(expanded(origStat), 0 )
555
556
}
556
557
557
558
/** Determines whether this field holds an enum constant. */
@@ -590,9 +591,11 @@ class Namer { typer: Typer =>
590
591
case _ =>
591
592
}
592
593
593
- def setDocstring (sym : Symbol , tree : Tree )(using Context ): Unit = tree match {
594
+ def setDocstring (sym : Symbol , tree : Tree , idx : Int )(using Context ): Unit = tree match {
594
595
case t : MemberDef if t.rawComment.isDefined =>
595
596
ctx.docCtx.foreach(_.addDocstring(sym, t.rawComment))
597
+ case t : ExtMethods if t.methods(idx).rawComment.isDefined =>
598
+ ctx.docCtx.foreach(_.addDocstring(sym, t.methods(idx).rawComment))
596
599
case _ => ()
597
600
}
598
601
0 commit comments