Open
Description
According to Scala language specification 4.1, the following code should have the same behavior:
Welcome to Scala 2.12.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.
scala> val (a: Any, b: Any) = (1, 2)
a: Any = 1
b: Any = 2
Welcome to Scala 2.12.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.
scala> val $x = (1, 2) match { case (a: Any, b: Any) => (a, b) }; val a = $x._1; val b = $x._2
$x: (Int, Int) = (1,2)
a: Int = 1
b: Int = 2
However, the type of a
and b
are different in the two examples.