Skip to content

Commit cdfc0f4

Browse files
committed
Let accesors inherit @experimental annotations from accessed symvbols
Fixes #16091
1 parent 562ab85 commit cdfc0f4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

compiler/src/dotty/tools/dotc/transform/AccessProxies.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ abstract class AccessProxies {
8080
val sym = newSymbol(owner, name, Synthetic | Method, info, coord = accessed.span).entered
8181
if accessed.is(Private) then sym.setFlag(Final)
8282
else if sym.allOverriddenSymbols.exists(!_.is(Deferred)) then sym.setFlag(Override)
83+
if accessed.hasAnnotation(defn.ExperimentalAnnot) then
84+
sym.addAnnotation(defn.ExperimentalAnnot)
8385
sym
8486
}
8587

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import scala.annotation.experimental
2+
3+
object Macro {
4+
@experimental
5+
inline def foo() = fooImpl
6+
7+
@experimental
8+
private def fooImpl = ()
9+
}

0 commit comments

Comments
 (0)