Skip to content

Commit

Permalink
Remove redundant definesMember check.
Browse files Browse the repository at this point in the history
[Cherry-picked 5be6fac]
  • Loading branch information
yilinwei authored and WojciechMazur committed Jun 30, 2024
1 parent 551816b commit 0899b4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ class Namer { typer: Typer =>
||
// remove synthetic constructor or method of a java Record if it clashes with a non-synthetic constructor
(isJavaRecord(denot.owner)
&& (denot.isConstructor || definesMember)
&& denot.is(Method)
&& denot.owner.unforcedDecls.lookupAll(denot.name).exists(c => c != denot.symbol && c.info.matches(denot.info))
)
)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
def canBeInvalidated(sym: Symbol): Boolean =
sym.is(Synthetic)
&& (desugar.isRetractableCaseClassMethodName(sym.name) ||
(sym.owner.is(JavaDefined) && sym.owner.derivesFrom(defn.JavaRecordClass)))
(sym.owner.is(JavaDefined) && sym.owner.derivesFrom(defn.JavaRecordClass) && sym.is(Method)))

if !sym.info.exists then
// it's a discarded method (synthetic case class method or synthetic java record constructor or overriden member), drop it
Expand Down

0 comments on commit 0899b4b

Please sign in to comment.