Skip to content
Closed
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
8 changes: 7 additions & 1 deletion src/dotty/tools/dotc/transform/ParamForwarding.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ class ParamForwarding(thisTransformer: DenotTransformer) {
val alias = inheritedAccessor(sym)
if (alias.exists) {
def forwarder(implicit ctx: Context) = {
sym.copySymDenotation(initFlags = sym.flags | Method | Stable, info = sym.info.ensureMethodic)
// as super alias was accessible it means it is NOT private
// we cannot override it by a private member
// as that will narrow access bounds
// needs to have the same access bounds as previous one
// TODO: why do we generate method at all? #783
val newFlags = sym.flags &~Private | Method | Stable | Override | (if (sym.is(Protected)) Protected else EmptyFlags)
sym.copySymDenotation(initFlags = newFlags, info = sym.info.ensureMethodic)
.installAfter(thisTransformer)
val superAcc =
Super(This(currentClass), tpnme.EMPTY, inConstrCall = false).select(alias)
Expand Down
6 changes: 6 additions & 0 deletions tests/run/i776.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class A1(val s: Int)
class A2(s: Int) extends A1(s)

object Test {
def main(args: Array[String]): Unit = new A2(2).s
}