Open rskfocus opened 6 months ago
This seems to be an issue with inference. There are the types that get inferred
val y: Tagged[Row[Int] & Row[String]] = run[Row[Int] & Row[String], Int](x, 1)
val z: <error unspecified error> = run[Row[Int] & Row[String], Int](x, "s")
Note that writing the type explicitly fixes the issue
val z = run[Row[Int] & Row[String], String](x, "s") // compiles
There does not seem to be any issue with commutativity.
I expect that order of types in an intersection type doesn't affect type inference.
That's nowhere claimed and is probably impossible to achieve given that our type inference is incomplete.
So, unless someone points out a specific point in Scala 3's type inference algorithm that can be improved, I don't see any actionables here.
Compiler version
3.4.0-RC1
Minimized code
Output
Expectation
I expect that order of types in an intersection type doesn't affect type inference.