class Foo {
let bar: () -> ()
func baz() {}
init() {
self.bar = baz // We oughta warn about capturing 'self' implicitly.
}
}
In the example above, we should warn about capturing `self` implicitly and, rather than suggest the user make it explicit, probably offer a fixit that provides a closure with a weak or unowned capture.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 2 | |Component/s | Compiler | |Labels | Improvement, StarterBug, TypeChecker | |Assignee | tt (JIRA) | |Priority | Medium | md5: cb331d15432b248f57b7b7bce4d077f7Issue Description:
In the example above, we should warn about capturing `self` implicitly and, rather than suggest the user make it explicit, probably offer a fixit that provides a closure with a weak or unowned capture.