Skip to content

Type member in subclass should shadow type member in owner #11953

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

Closed
japgolly opened this issue Mar 30, 2021 · 2 comments
Closed

Type member in subclass should shadow type member in owner #11953

japgolly opened this issue Mar 30, 2021 · 2 comments

Comments

@japgolly
Copy link
Contributor

Compiler version

3.0.0-RC1

Minimized code

trait X { type M = Int }

object Y {
  type M = String

  class C extends X {
    def m: M = 123
  }
}

Output

7 |    def m: M = 123
  |           ^
  |           Reference to M is ambiguous,
  |           it is both defined in object Y
  |           and inherited subsequently in class C

Expectation

It should compile. (It does in Scala 2.x)

@smarter
Copy link
Member

smarter commented Mar 30, 2021

This is an intentional change in what constitutes shadowing: #8622 (the backstory is scala/bug#11921)

@smarter smarter closed this as completed Mar 30, 2021
@japgolly
Copy link
Contributor Author

Ah ok cool thanks

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

3 participants