Skip to content

Commit 0610cf2

Browse files
committed
Remove Accessed annotations once accessors are generated.
1 parent 1986c03 commit 0610cf2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,15 @@ object Inliner {
126126
else addAccessors.transform(tree)
127127
}
128128

129-
/** The inline accessor definitions that need to be added to class `cls` */
129+
/** The inline accessor definitions that need to be added to class `cls`
130+
* As a side-effect, this method removes the `Accessed` annotations from
131+
* the accessor symbols. So a second call of the same method will yield the empty list.
132+
*/
130133
def accessorDefs(cls: Symbol)(implicit ctx: Context): List[DefDef] =
131134
for (accessor <- cls.info.decls.filter(sym => sym.name.is(InlineGetterName) || sym.name.is(InlineSetterName)))
132135
yield polyDefDef(accessor.asTerm, tps => argss => {
133136
val Annotation.Accessed(accessed) = accessor.getAnnotation(defn.AccessedAnnot).get
137+
accessor.removeAnnotation(defn.AccessedAnnot)
134138
val rhs =
135139
if (accessor.name.is(InlineSetterName) &&
136140
argss.nonEmpty && argss.head.nonEmpty) // defensive conditions

0 commit comments

Comments
 (0)