Skip to content

Unable to introduce packaging _root_._root_ #12508

Closed as not planned
Closed as not planned
@som-snytt

Description

@som-snytt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions