Tuple pattern matching weirdness in 2.12

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Tuple pattern matching weirdness in 2.12

Michal Čudrnák
Having trouble with the following snippet in 2.12.1, where a matched variable name ('a') seems to get conflated with an unused function argument 'a', which seems like an obvious bug but I thought I'd check here before filing:

scala> def r(a: Int = 1, b: Int = 2) = (0, 0)
r: (a: Int, b: Int)(Int, Int)

scala> val (a, x) = r(b=4)
<console>:17: error: recursive value x$1 needs type
       val (a, x) = r(b=4)
            ^
<console>:17: warning: failed to determine if 'a = ...' is a named argument or an assignment expression.
an explicit type is required for the definition mentioned in the error message above.
       val (a, x) = r(b=4)

Following the suggestion fixes the issue but why does it exist in the first place?

Cheers
Michal

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tuple pattern matching weirdness in 2.12

Seth Tisue
looks like SI-5091

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...