Open
Description
Compiler version
Scala 3.3.1-RC1-bin-20230327-a569057-NIGHTLY
Minimized code
object foo:
opaque type Foo = Array[String]
def create(array: Array[String]): Foo = array
extension (headers: Foo)
def length: Int = 10
def printLength(): Unit = {
println(s"length = $length")
}
@main
def main =
val headers = foo.create(Array("foo", "bar"))
println(s"length = ${headers.length}")
headers.printLength()
Output
length = 10
length = 2
Expectation
The extension method length
should be called both from outside of the extension
and inside.
If it is not possible to call it from inside the extension
itself, then it should fail to compile instead
of silently having the underlying type behavior.