Closed
Description
Minimized code
abstract class WordSpec {
export this.{extension_in => extension_should}
extension(s: String) def in(f: => Any): Unit = {
println(s)
f
}
}
object test extends WordSpec {
"X" should {
"add numbers" in {
assert(1 + 1 == 2)
}
}
}
Output
no eligible member extension_in at this
this.extension_in cannot be exported because it is already a member of class AnyWordSpec
export this.{extension_in => extension_should}
Expectation
Seems like the check for duplicates is over-eager and happens before renames are taken into account, making it illegal to rename symbols in this
, but legal otherwise. Workaround is to create a proxy object and re-export from it:
abstract class WordSpec {
export inner.{extension_in => extension_should}
export inner.extension_in
object inner {
extension(s: String) def in(f: => Any): Unit = {
println(s)
f
}
}
}