Support using instance's property as a default instance method argument
| Originator: | pitiphong.ph | ||
| Number: | rdar://20509799 | Date Originated: | 11-Apr-2015 05:45 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 1.2 |
| Classification: | Feature (New) | Reproducible: | Not Applicable |
Summary:
Support using instance's property as a default instance method argument
Steps to Reproduce:
Define a class with a property when define its instance method which has arguments and one of them has default argument with its property value
class Holder {
var size: Size = Size(width: 2.0, height: 3.0) {
didSet {
println("Size: " + self.size.description)
}
}
static var defaultSize = Size(width: 0.0, height: 0.0)
func test(size: Size = self.size) {
println(size)
}
func giant() {
size.width *= 2
size.height *= 2
}
}
Expected Results:
Function should accept its property as a default argument
Actual Results:
compile error.
Regression:
Notes:
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!