Closed
Description
Compiler version
3.6.2
Minimized example
import scala.Tuple
class Container[Rs <: Tuple] {
def guard(a: Tuple.Tail[Rs]): Unit = ()
}
@main def main(): Unit =
Container[(1,2,3)].guard((5, 6, 8))
Output Error message
[error] -- [E007] Type Mismatch Error: Main.scala:8:27
[error] 8 | Container[(1,2,3)].guard((5, 6, 8))
[error] | ^^^^^^^^^
[error] | Found: (Int, Int, Int)
[error] | Required: Tuple.Tail[((1 : Int), (2 : Int), (3 : Int))]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] one error found
Why this Error/Warning was not helpful
The message was unhelpful because it contains unevaluated type matches (Tuple.Tail
) that depend on entirely known types.
Suggested improvement
It could look like
[error] 8 | Container[(1,2,3)].guard((5, 6, 8))
[error] | ^^^^^^^^^
[error] | Found: (Int, Int, Int)
[error] | Required: ((2 : Int), (3 : Int))