Swift 1.2b2: Parameters which are of function type cannot have their parameters marked as @noescape
| Originator: | rix.rob | ||
| Number: | rdar://19997680 | Date Originated: | 28-Feb-2015 07:11 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (6D532l) |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
Trying to work around rdar://19997577 I figured I’d write a function which applies one operand to another operand. That doesn’t fly because @noescape can’t be applied to parameters of parameters.
Steps to Reproduce:
1. Write this:
func apply<T, U>(@noescape f: T -> U, @noescape g: (T -> U) -> U) -> U {
return g(f)
}
2. Oops, g’s parameter would need to be @noescape too!
3. Write this:
func apply<T, U>(@noescape f: T -> U, @noescape g: (@noescape T -> U) -> U) -> U {
return g(f)
}
4. Hm, that’s not valid.
5. Write this:
func apply<T, U>(@noescape f: T -> U, @noescape g: (@noescape f: T -> U) -> U) -> U {
return g(f)
}
Expected Results:
I expected something in this chain to work.
Actual Results:
None of it worked.
Regression:
N/A
Notes:
This is Damien’s fault. https://twitter.com/launchz/status/571822195120340992
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!