Skip to content

Instantly share code, notes, and snippets.

@LeifW
Created August 13, 2012 10:31
Show Gist options
  • Select an option

  • Save LeifW/3339238 to your computer and use it in GitHub Desktop.

Select an option

Save LeifW/3339238 to your computer and use it in GitHub Desktop.
overloaded method WTF
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