Skip to content

Commit 789ceb1

Browse files
committed
Make bean properties invisible
Load bean properties in TreeUnpickler but make them invisible to Typer. This looks like the safer choice.
1 parent 09b7746 commit 789ceb1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,11 +585,9 @@ class TreeUnpickler(reader: TastyReader,
585585
val annots = annotFns.map(_(sym.owner))
586586
sym.annotations = annots
587587
if sym.isOpaqueAlias then sym.setFlag(Deferred)
588-
val isSyntheticBeanAccessor = flags.isAllOf(Method | Synthetic) &&
589-
annots.exists(a => a.matches(defn.BeanPropertyAnnot) || a.matches(defn.BooleanBeanPropertyAnnot))
590588
val isScala2MacroDefinedInScala3 = flags.is(Macro, butNot = Inline) && flags.is(Erased)
591589
ctx.owner match {
592-
case cls: ClassSymbol if (!isScala2MacroDefinedInScala3 || cls == defn.StringContextClass) && !isSyntheticBeanAccessor =>
590+
case cls: ClassSymbol if !isScala2MacroDefinedInScala3 || cls == defn.StringContextClass =>
593591
// Enter all members of classes that are not Scala 2 macros or synthetic bean accessors.
594592
//
595593
// For `StringContext`, enter `s`, `f` and `raw`

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BeanProperties(thisPhase: DenotTransformer):
3131
val meth = newSymbol(
3232
owner = ctx.owner,
3333
name = prefixedName(prefix, valDef.name),
34-
flags = Method | Synthetic,
34+
flags = Method | Synthetic | Invisible,
3535
info = MethodType(Nil, valDef.denot.info),
3636
coord = annot.tree.span
3737
).enteredAfter(thisPhase).asTerm
@@ -45,7 +45,7 @@ class BeanProperties(thisPhase: DenotTransformer):
4545
val meth = newSymbol(
4646
owner,
4747
name = prefixedName("set", valDef.name),
48-
flags = Method | Synthetic,
48+
flags = Method | Synthetic | Invisible,
4949
info = MethodType(valDef.name :: Nil, valDef.denot.info :: Nil, defn.UnitType),
5050
coord = annot.tree.span
5151
).enteredAfter(thisPhase).asTerm

0 commit comments

Comments
 (0)