Inconsistent behavior in Swift function parameters

Originator:jay
Number:rdar://17810175 Date Originated:2014-07-25
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
 
Summary:
The behavior of functions in Swift is inconsistent when defined with and without default parameter values.

Steps to Reproduce:
See the following example from the Swift REPL:

1> func foo(bar: String) {
  2.     println(bar)
  3. }
  4> foo("bar")
bar
  5> func bar(baz: String = "baz") {
  6.     println(baz)
  7. }
  8> bar()
baz
  9> bar("eh")
/var/folders/69/rxq8jsz144l6q4833xpqk1rw0000gp/T//lldb/60470/expr.fiGryv.swift:2:5: error: missing argument label 'baz:' in call
bar("eh")
    ^
    baz:

Expected Results:
I would have expected Swift to not externalize the `baz` parameter in the second function definition.

Actual Results:
The `baz` parameter is externalized and must be explicitly stated in invocations.

Version:
Xcode 6.0
Build version 6A267n

ProductName:    Mac OS X
ProductVersion: 10.9.4
BuildVersion:   13E28

Swift version 1.0 (swift-600.0.41.2.2)
Target: x86_64-apple-darwin13.3.0

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!