Think about the code below:
object My extends App { def increment(key: Any) { println(key); } increment("hello"); increment("world", 6, 7); }
I intent to see the compiler error for second ‘increment’ int the first place. But it don’t, the compiler report ok and the output of the program is:
hello (world,6,7)
The compiler recognize the three arguments “world”, “6”, “7” as a tuple of (“world”, 6, 7). So the correct type of arugment for function ‘increment’ should be ‘String’:
def increment(key: String) { ....