Closed
Description
Compiler version
3.0.2
3.1.0 makes the Scala plugin for Idea think it needs Scala 2 syntax, where can I report this?
Minimized code
// bound for Function in feature request
// type of domain and codomain for Function in feature request
type Domain[F] <: Tuple = F match
case Function1[r, _] => Tuple1[r]
case Function2[r1, r2, _] => Tuple2[r1, r2]
case Function3[r1, r2, r3, _] => Tuple3[r1, r2, r3]
@main def m =
val f: Int => Int = _*2
val g: (Int, Int) => Int = _*_
val h: (Boolean, Int, Int) => Int = if _ then _ else _
val a: Domain[f.type] = Tuple1(3)
val b: Domain[g.type] = Tuple2(3, 4)
val c: Domain[h.type] = Tuple3(false, 5, 6)
// println(f.tupled(b)) in feature request
println(g.tupled(b))
println(h.tupled(c))
Output
Found: (Int, Int)
Required: Domain[(g : (Int, Int) => Int)]
val b: Domain[g.type] = Tuple2(3, 4)
Found: (Boolean, Int, Int)
Required: Domain[(h : (Boolean, Int, Int) => Int)]
val c: Domain[h.type] = Tuple3(false, 5, 6)
Found: (b : Domain[(g : (Int, Int) => Int)])
Required: (Int, Int)
println(g.tupled(b))
Found: (c : Domain[(h : (Boolean, Int, Int) => Int)])
Required: (Boolean, Int, Int)
println(h.tupled(c))
Expectation
To run. Sadly with the uninformative error messages I can not say much more.
Changing the order in the match type changes which cases error, so I guess it's all matching to the first case.
The feature requests I'm referring to (that would avoid this snag) is lampepfl/dotty-feature-requests#246.
EDIT: Add def
in code example