Swift: Curried Funcations have incorrect naming rules

Originator:owensd
Number:rdar://18717661 Date Originated:20-Oct-2014 09:44 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.1 (6A1052c)
Classification:Security Reproducible:Always
 
Summary:
The naming rules for parameters are messed up with curried functions.

Steps to Reproduce:
Define the following three functions:

func const<A, B>(a: A)(b: B) -> A {
    return a
}

func foo<A, B>(a: A, b: B) -> A {
    return a
}

func bar<A, B>(a: A) -> B -> A {
    return { _ in a }
}


Expected Results:
I should be able to call the functions like:

const(4)(1)
foo(4, 5)
bar(4)(3)

Actual Results:
I have to actually provide the name for the second parameter for the func “const”.

const(4)(b: 1)
foo(4, 5)
bar(4)(3)

Further, defining the function const as:

func const<A, B>(a: A)(_ b: B) -> A { … }

That results in a compiler warning for the argument name and a compiler error for:

const(4)(1)

Regression:
Yes, I believe I was able to do this in earlier builds.

Notes:
Provide additional information, such as references to related problems, workarounds and relevant attachments.

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!