Closed
Description
Compiler version
Observing this failure since Scala 3.4, the error persisted all the way till 3.6.1
Minimized code
trait A extends Iterable[String]
trait Test {
extension (a: A) def foo: String = "foo"
}
object Test {
def foo(s: String, acc: List[String] = Nil) = ???
}
Output
a false positive compiler warning:
[Warn] /.../src/main/scala/Test.scala:6:24: Extension method foo will never be selected
Expectation
The code works as expected after compilation. Extension method is always rightfully selected. The actual code that triggers it in my project is even weirder because it's nested deeper inside companion object like so:
trait A extends Iterable[String]
trait Test {
extension (a: A) def foo: String = "foo"
}
object Test {
object Nested {
def foo(s: String, acc: List[String] = Nil) = ???
}
}
still triggers the same error.