Skip to content
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

Cannot access private members in sub-type values #8432

Closed
scabug opened this issue Mar 20, 2014 · 2 comments
Closed

Cannot access private members in sub-type values #8432

scabug opened this issue Mar 20, 2014 · 2 comments
Assignees

Comments

@scabug
Copy link

scabug commented Mar 20, 2014

The following regression occurs in Scala 2.11.0-RC3 versus 2.10.3

trait Foo {
  trait X {
    def bar(y: Y): Unit = y.baz()

    private def baz() = ()
  }

  trait Y extends X
}

This compiles in 2.10.3. In 2.11.0-RC3, you get

[error] .../Foo.scala:5: value baz is not a member of Foo.this.Y
[error]     def bar(y: Y): Unit = y.baz()
@scabug
Copy link
Author

scabug commented Mar 20, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8432?orig=1
Reporter: @Sciss
Affected Versions: 2.11.0-RC3
See #7475

@scabug
Copy link
Author

scabug commented Mar 20, 2014

@retronym said:
See #7475, this was actually a bug fix. It's a bit non-intuitive, but we determined it was the right course of action.

You need to explicitly upcast:

   (y: X).baz()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants