@@ -97,13 +97,10 @@ class Memoize extends MiniPhase with IdentityDenotTransformer { thisPhase =>
97
97
case _ => ()
98
98
}
99
99
100
- def removeUnwantedAnnotations (denot : SymDenotation ): Unit =
100
+ def removeUnwantedAnnotations (denot : SymDenotation , metaAnnotSym : ClassSymbol ): Unit =
101
101
if (sym.annotations.nonEmpty) {
102
102
val cpy = sym.copySymDenotation()
103
- // Keep @deprecated annotation so that accessors can
104
- // be marked as deprecated in the bytecode.
105
- // TODO check the meta-annotations to know what to keep
106
- cpy.filterAnnotations(_.matches(defn.DeprecatedAnnot ))
103
+ cpy.filterAnnotations(_.symbol.hasAnnotation(metaAnnotSym))
107
104
cpy.installAfter(thisPhase)
108
105
}
109
106
@@ -141,7 +138,7 @@ class Memoize extends MiniPhase with IdentityDenotTransformer { thisPhase =>
141
138
else transformFollowingDeep(ref(field))(using ctx.withOwner(sym))
142
139
val getterDef = cpy.DefDef (tree)(rhs = getterRhs)
143
140
addAnnotations(fieldDef.denot)
144
- removeUnwantedAnnotations(sym)
141
+ removeUnwantedAnnotations(sym, defn. GetterMetaAnnot )
145
142
Thicket (fieldDef, getterDef)
146
143
else if sym.isSetter then
147
144
if (! sym.is(ParamAccessor )) { val Literal (Constant (())) = tree.rhs } // This is intended as an assertion
@@ -162,7 +159,7 @@ class Memoize extends MiniPhase with IdentityDenotTransformer { thisPhase =>
162
159
if (isErasableBottomField(field, tree.vparamss.head.head.tpt.tpe.classSymbol)) Literal (Constant (()))
163
160
else Assign (ref(field), adaptToField(field, ref(tree.vparamss.head.head.symbol)))
164
161
val setterDef = cpy.DefDef (tree)(rhs = transformFollowingDeep(initializer)(using ctx.withOwner(sym)))
165
- removeUnwantedAnnotations(sym)
162
+ removeUnwantedAnnotations(sym, defn. SetterMetaAnnot )
166
163
setterDef
167
164
else
168
165
// Curiously, some accessors from Scala2 have ' ' suffixes.
0 commit comments