Skip to content

Fix #4753: Direct method should keep Override if overriden nonempty #4792

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
Jul 17, 2018
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,14 @@ object ShortcutImplicits {
}

/** A new `m$direct` method to accompany the given method `m` */
private def newShortcutMethod(sym: Symbol)(implicit ctx: Context): Symbol =
sym.copy(
private def newShortcutMethod(sym: Symbol)(implicit ctx: Context): Symbol = {
val direct = sym.copy(
name = DirectMethodName(sym.name.asTermName).asInstanceOf[sym.ThisName],
flags = sym.flags &~ Override | Synthetic,
flags = sym.flags | Synthetic,
info = directInfo(sym.info))
if (direct.allOverriddenSymbols.isEmpty) direct.resetFlag(Override)
direct
}

def shortcutMethod(sym: Symbol, phase: DenotTransformer)(implicit ctx: Context) =
sym.owner.info.decl(DirectMethodName(sym.name.asTermName))
Expand Down
7 changes: 7 additions & 0 deletions tests/pos/i4753b.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Foo1 {
def foo: implicit String => Int = 1
}

class Foo2 extends Foo1 {
override def foo: implicit String => Int = 2
}