Syntax for disambiguating functions?

I thought we had a solution to the following scenario, but I can’t find it. How are users supposed to disambiguate the following?

func foo(a:Int) {}
func foo(b:Int) {}
let f = foo // error: ambiguous use of 'foo'

Thanks,
Dave

let f = foo(a:)
4 Likes

Well, I’m not crazy then. That apparently doesn’t work in the 4.0.3 LLDB REPL, but it does work in the top-of-tree integrated REPL. Is there a REPL-specifc test case for this?

Thanks Ben!

$ swift
Welcome to Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2). Type :help for assistance.
  1> func foo(a:Int){}
  2> func foo(b:Int){}
  3> let f = foo
error: repl.swift:3:9: error: ambiguous use of 'foo'
let f = foo
        ^


  3> let f = foo(a:)
error: repl.swift:3:9: error: use of unresolved identifier 'foo(a:)'
let f = foo(a:)
        ^~~~~~~

For reference, this is the error that occurs. It’s working fine in playground

2 Likes