Created
August 13, 2012 10:31
-
-
Save LeifW/3339238 to your computer and use it in GitHub Desktop.
overloaded method WTF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Foo { | |
| def f(numbers: Int*)(n1:String) = numbers.sum | |
| def f(numbers: Int*)(n1:String, n2: String) = numbers.sum | |
| def f(numbers: Int*)(n1:String, n2: String, n3:String) = numbers.sum | |
| } | |
| scala> Foo.f(1,2,3)("n") | |
| <console>:8: error: ambiguous reference to overloaded definition, | |
| both method f in object Foo of type (numbers: Int*)(name: String, n2: String, n3: String)Int | |
| and method f in object Foo of type (numbers: Int*)(name: String, n2: String)Int | |
| match argument types (Int,Int,Int) | |
| Foo.f(1,2,3)("n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment