File tree 2 files changed +13
-3
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -181,11 +181,14 @@ object ShortcutImplicits {
181
181
}
182
182
183
183
/** A new `m$direct` method to accompany the given method `m` */
184
- private def newShortcutMethod (sym : Symbol )(implicit ctx : Context ): Symbol =
185
- sym.copy(
184
+ private def newShortcutMethod (sym : Symbol )(implicit ctx : Context ): Symbol = {
185
+ val direct = sym.copy(
186
186
name = DirectMethodName (sym.name.asTermName).asInstanceOf [sym.ThisName ],
187
- flags = sym.flags &~ Override | Synthetic ,
187
+ flags = sym.flags | Synthetic ,
188
188
info = directInfo(sym.info))
189
+ if (direct.allOverriddenSymbols.isEmpty) direct.resetFlag(Override )
190
+ direct
191
+ }
189
192
190
193
def shortcutMethod (sym : Symbol , phase : DenotTransformer )(implicit ctx : Context ) =
191
194
sym.owner.info.decl(DirectMethodName (sym.name.asTermName))
Original file line number Diff line number Diff line change
1
+ class Foo1 {
2
+ def foo : implicit String => Int = 1
3
+ }
4
+
5
+ class Foo2 extends Foo1 {
6
+ override def foo : implicit String => Int = 2
7
+ }
You can’t perform that action at this time.
0 commit comments