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

Unable to introduce packaging _root_._root_ #12508

Open
som-snytt opened this issue Dec 7, 2021 · 1 comment
Open

Unable to introduce packaging _root_._root_ #12508

som-snytt opened this issue Dec 7, 2021 · 1 comment
Milestone

Comments

@som-snytt
Copy link

som-snytt commented Dec 7, 2021

reproduction steps

Scala 2.13.7 and 3 differ as to whether these packagings are erroneous:

package _root_ {
  class C {
    val _root_ = 42
  }
}
package _root_.p {
  class C
}

Scala 2 is definitely wrong in rejecting _root_, as the spec is now clear that only the selection _root_.x makes _root_ mean the root package.

Once _root_ is defined, possibly the second packaging should put p.C in it. Scala 2 warns about such a case:

// neg/t6217c.scala
package a {
  package _root_ {
    object X
  }
  package _root_.p {
    object Y
  }
}

Scala 3 compiles the first example but not the second.

problem

The versions ought to agree.

@som-snytt
Copy link
Author

Scala 2 installs a package _root_ in the root scope, which is why it balks at the user package of the same name.

smarter added a commit to scala/scala3 that referenced this issue Jul 14, 2023
References #18020, didn't actually fix that, because it addressed
aspects of using `_root_` in definitions. Adding more details to that
ticket.
Fixes #17757
Fixes #18050
Includes the code in scala/bug#12508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants