You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
objectTest {
objectE1 {
defunapply(x: Int):Some[Tuple.Map[(Int, Int), Option]] =???
}
vals:Int=???
s match {
caseE1(x, y) => x
}
}
Output
$ scalac unapply_matchtype.scala
-- [E107] SyntaxError: unapply_matchtype.scala:10:11----------------------------------------10|caseE1(x, y) => x
|^^^^^^^^|Wrong number of argument patterns forTest.E1; expected: ((Option[Int], Option[Int]))
|| longer explanation available when compiling with`-explain`1 error found
Expectation
Code should compile without warnings or errors.
Dropping the Option in the return type makes the code work. So the following code compiles
object Test {
object E1 {
def unapply(x: Int): Tuple.Map[(Int, Int), Option] = ???
}
val s: Int = ???
s match {
case E1(x, y) => x
}
}
But can not be used a general fix at that will run into #22355 in generic code.
The text was updated successfully, but these errors were encountered:
eejbyfeldt
changed the title
Wrong number of argument
Incorrect "Wrong number of argument patterns" error for Option extractor using Tuple.MapApr 7, 2025
Compiler version
3.6.4
Minimized code
Output
Expectation
Code should compile without warnings or errors.
Dropping the
Option
in the return type makes the code work. So the following code compilesBut can not be used a general fix at that will run into #22355 in generic code.
The text was updated successfully, but these errors were encountered: