Skip to content

Commit 41aa184

Browse files
committed
Maintain Extension flags for forwarders when creating an anonymous class.
This causes an error in RefChecks for run/fragables-extension.scala otherwise. Previously the error was not detected since methods created in the same group as RefChecks are not checked.
1 parent 4ce42eb commit 41aa184

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
350350
val constr = newConstructor(cls, Synthetic, Nil, Nil).entered
351351
def forwarder(fn: TermSymbol, name: TermName) = {
352352
val fwdMeth = fn.copy(cls, name, Synthetic | Method | Final).entered.asTerm
353-
if (fwdMeth.allOverriddenSymbols.exists(!_.is(Deferred))) fwdMeth.setFlag(Override)
353+
for overridden <- fwdMeth.allOverriddenSymbols do
354+
if overridden.is(Extension) then fwdMeth.setFlag(Extension)
355+
if !overridden.is(Deferred) then fwdMeth.setFlag(Override)
354356
polyDefDef(fwdMeth, tprefs => prefss => ref(fn).appliedToTypes(tprefs).appliedToArgss(prefss))
355357
}
356358
val forwarders = fns.lazyZip(methNames).map(forwarder)

0 commit comments

Comments
 (0)