Why parentheses around int on a scala method invocation

scala

Solution

When you say `1.*(2)` it's ambiguous as to whether you mean:

`(1).*(2)`, which results in an Int

or

`(1.)*(2)`, which results in a Double, since `1.` is valid syntax meaning the Double `1.0`

Scala currently treats it as the second one, but since the correct behavior isn't obvious, it will be changing from Scala 2.11 onwards to treat it like the first one. Scala warns you that its behavior will change.

Problem

I'm going through a Scala tutorial, and it's explaining that all operators are actually method invocations. So `1 * 2` is really: ``` scala> (1).*(2) res1: Int = 2 ``` Just to see what would happen, I ran: ``` scala> 1.*(2) warning: there were 1 deprecation warning(s); re-run with -deprecation for details res2: Double = 2.0 ``` So I run it again with the deprecation flag and I get: ``` scala> 1.*(2) <console>:1: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. 1.*(2) ``` Could someone please explain this warning to me, and also explain to me what purpose the parentheses around the 1 in `scala> (1).*(2)` serve?

Original source