scala3
scala3 copied to clipboard
Regression in legality of SAM methods
Regression found in the Open CB #8414 for mjakubowski84/parquet4s
Compiler version
Fails with 3.2.1-RC2 Works with 3.2.1-RC1
Bisect points to 57f53d0725c859bffcadc8919524b9b0d43805ba Might be related to https://github.com/lampepfl/dotty/issues/16049 and it's fix https://github.com/lampepfl/dotty/pull/16070
Minimized code
trait Column[V]
trait ColumnPath
trait ColumnFactory[V, C <: Column[V]]:
def apply(columnPath: ColumnPath): C
object ColumnFactory:
private def apply[V, C <: Column[V]](f: String => C): ColumnFactory[V, C] =
columnPath => f(columnPath.toString())
Output
Compiling project (Scala 3.2.1-RC2, JVM)
[error] ./test.scala:9:43: ColumnFactory[V, C] is not a legal SAM type
[error] since it has a member C with possibly conflicting bounds C <: ... <: Column[V] & C
[error] columnPath => f(columnPath.toString())
[error] ^
Expectation
Should compile
I verified that #16070 fixes this as well.