Skip to content

Commit 2ca5d1f

Browse files
committed
Fix #9155: Propagate @Alpha on export forwarders
1 parent 4b39622 commit 2ca5d1f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,9 @@ class Namer { typer: Typer =>
11291129
ctx.newSymbol(cls, forwarderName, mbrFlags, mbrInfo, coord = span)
11301130
}
11311131
forwarder.info = avoidPrivateLeaks(forwarder)
1132+
for annot <- sym.annotations do
1133+
if annot.tree.symbol.maybeOwner == defn.AlphaAnnot then
1134+
forwarder.addAnnotation(annot)
11321135
val forwarderDef =
11331136
if (forwarder.isType) tpd.TypeDef(forwarder.asType)
11341137
else {

tests/run/i9155.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
object Foo:
2+
@scala.annotation.alpha("w") def \/\/ = "W"
3+
4+
object Bar:
5+
export Foo._
6+
7+
@main def Test =
8+
assert(Foo.getClass.getMethods.exists(_.getName == "w"))
9+
assert(Bar.getClass.getMethods.exists(_.getName == "w"))

0 commit comments

Comments
 (0)