Open
Description
Compiler version
3.5.0, same behavior in 2.13.14
Minimized code
The following code does not print Hello outer
object outer{
println("Hello outer")
object Foo
}
object Test{
def main(args: Array[String]): Unit = println("Hello " + outer.Foo)
}
But if I wrap the object outer
in a trait
, it does print Hello outer
trait wrapper{
object outer{
println("Hello outer")
object Foo
}
}
object Test{
def main(args: Array[String]): Unit = {
println("Hello " + new wrapper{}.outer.Foo)
}
}
Expectation
I would expect the initialization behavior of nested objects to be consistent regardless of whether or not they are wrapped in traits