class Bar {val glass : Int = 0}
class Foo(val bar : Bar)
val f = new Foo(new Bar) {
export bar._
}
val fGlass = f.glass //error: value glass is not a member of Foo
This code should compile. I see no reason why export shouldn't work in anonymous classes.
This has nothing to do with exports. If you replace the export with val glass = bar.glass, it fails as well. See
https://contributors.scala-lang.org/t/better-type-inference-for-scala-send-us-your-problematic-cases/2410/73 for background.
I believe we should implement the Structural idea that @smarter proposed in that thread, though.
Fixed in #9201
class Bar {val glass : Int = 0}
class Foo(val bar : Bar) extends scala.reflect.Selectable
val f = new Foo(new Bar) {
export bar._
}
val fGlass = f.glass
Most helpful comment
This has nothing to do with exports. If you replace the export with
val glass = bar.glass, it fails as well. Seehttps://contributors.scala-lang.org/t/better-type-inference-for-scala-send-us-your-problematic-cases/2410/73 for background.
I believe we should implement the
Structuralidea that @smarter proposed in that thread, though.