Open som-snytt opened 2 years ago
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.
_root_
_root_.x
Once _root_ is defined, possibly the second packaging should put p.C in it. Scala 2 warns about such a case:
p.C
// neg/t6217c.scala package a { package _root_ { object X } package _root_.p { object Y } }
Scala 3 compiles the first example but not the second.
The versions ought to agree.
Scala 2 installs a package _root_ in the root scope, which is why it balks at the user package of the same name.
package _root_
reproduction steps
Scala 2.13.7 and 3 differ as to whether these packagings are erroneous:
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 putp.C
in it. Scala 2 warns about such a case:Scala 3 compiles the first example but not the second.
problem
The versions ought to agree.