Skip to content

Commit a0c523d

Browse files
committed
Remove Permanent flag from sythetic accessors
1 parent f6b18ac commit a0c523d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package transform
33

44
import core._
55
import ast.tpd._
6-
import Contexts.Context
6+
import Contexts._
77
import SymDenotations._
88
import Symbols.newSymbol
99
import Decorators._
@@ -27,9 +27,9 @@ class BeanProperties(thisPhase: DenotTransformer):
2727
def generateGetter(valDef: ValDef)(using Context) : Tree =
2828
val prefix = if valDef.symbol.denot.hasAnnotation(defn.BooleanBeanPropertyAnnot) then "is" else "get"
2929
val meth = newSymbol(
30-
owner = summon[Context].owner,
30+
owner = ctx.owner,
3131
name = prefixedName(prefix, valDef.name),
32-
flags = Method | Permanent | Synthetic,
32+
flags = Method | Synthetic,
3333
info = MethodType(Nil, valDef.denot.info))
3434
.enteredAfter(thisPhase).asTerm
3535
meth.addAnnotations(valDef.symbol.annotations)
@@ -38,7 +38,7 @@ class BeanProperties(thisPhase: DenotTransformer):
3838

3939
def maybeGenerateSetter(valDef: ValDef)(using Context): Option[Tree] =
4040
Option.when(valDef.denot.asSymDenotation.flags.is(Mutable)) {
41-
val owner = summon[Context].owner
41+
val owner = ctx.owner
4242
val meth = newSymbol(
4343
owner,
4444
name = prefixedName("set", valDef.name),
@@ -53,9 +53,8 @@ class BeanProperties(thisPhase: DenotTransformer):
5353
def prefixedName(prefix: String, valName: Name) =
5454
(prefix + valName.lastPart.toString.capitalize).toTermName
5555

56-
extension(a: SymDenotation) def isApplicable = a.hasAnnotation(defn.BeanPropertyAnnot) || a.hasAnnotation(defn.BooleanBeanPropertyAnnot)
57-
58-
if valDef.denot.symbol.isApplicable then
56+
val symbol = valDef.denot.symbol
57+
if symbol.hasAnnotation(defn.BeanPropertyAnnot) || symbol.hasAnnotation(defn.BooleanBeanPropertyAnnot) then
5958
generateGetter(valDef) +: maybeGenerateSetter(valDef) ++: Nil
6059
else Nil
6160
end generateAccessors

0 commit comments

Comments
 (0)