Swift 2: SequenceType extension methods cannot be partially applied
| Originator: | rix.rob | ||
| Number: | rdar://21289273 | Date Originated: | 08-Jun-2015 05:33 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-7-beta (7A120f) |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
Partial application of SequenceType methods is not functioning.
Steps to Reproduce:
1. Write these:
let f = SequenceType.reduce
let g: [Int] -> (Int, (Int, Int) -> Int) -> Int = SequenceType.reduce
let h: ([Int], (Int, (Int, Int) -> Int)) -> Int = SequenceType.reduce
Expected Results:
The first is wishful thinking, I don’t expect Swift to suddenly have let-polymorphism.
The second is assuming that protocol extension methods are curried the way normal methods are.
The third is assuming that protocol extension methods are uncurried like free functions are.
Actual Results:
All three give the same unhelpful errors:
./partial.swift:3:9: error: 'SequenceType.Protocol' does not have a member named 'reduce'
let f = SequenceType.reduce
^ ~~~~~~
./partial.swift:3:9: error: protocol 'SequenceType' can only be used as a generic constraint because it has Self or associated type requirements
let f = SequenceType.reduce
^
Regression:
I could partially apply `reduce` as a free function in Swift 1.2.
Notes:
N/A
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!