-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
accessfixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Milestone
Description
Reproduction steps
Scala version: 2.13.11
package p {
class C {
protected def f() = ()
}
class X {
this: C =>
def g() = f()
}
}
package p.s {
import p._
class Y {
this: C =>
def g() = f()
}
}
package q {
import p._
class Z {
this: C =>
def g() = f() // illegal access to protected method f in class C from class Z
}
}
Problem
Access to protected f
requires that the enclosing class X
be a subclass of C
, not merely that this
is.
Dotty currently allows access within p
, per the linked ticket, but disallows in q
.
Scala 2 accepts the example.
Noticed at scala/scala3#18245
coreywoodfield and He-Pin
Metadata
Metadata
Assignees
Labels
accessfixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)