Skip to content

Simpler way to test if a new symbol overriddes something #4606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions compiler/src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
coord = fns.map(_.pos).reduceLeft(_ union _))
val constr = ctx.newConstructor(cls, Synthetic, Nil, Nil).entered
def forwarder(fn: TermSymbol, name: TermName) = {
var flags = Synthetic | Method | Final
def isOverriden(denot: SingleDenotation) = fn.info.overrides(denot.info, matchLoosely = true)
val isOverride = parents.exists(_.member(name).hasAltWith(isOverriden))
if (isOverride) flags = flags | Override
val fwdMeth = fn.copy(cls, name, flags).entered.asTerm
val fwdMeth = fn.copy(cls, name, Synthetic | Method | Final).entered.asTerm
if (fwdMeth.allOverriddenSymbols.exists(!_.is(Deferred))) fwdMeth.setFlag(Override)
polyDefDef(fwdMeth, tprefs => prefss => ref(fn).appliedToTypes(tprefs).appliedToArgss(prefss))
}
val forwarders = (fns, methNames).zipped.map(forwarder)
Expand Down