SE-0269: Increase availability of implicit self in @escaping closures when reference cycles are unlikely to occur

@Jumhyn

As I see in the proposal you wrote, in the detailed design section you mention this case

execute { [self] in
    execute { // Fix-it: capture 'self' explicitly to enable implicit 'self' in this closure.
        x += 1 // Error: reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit. Fix-it: reference 'self.' explicitly.
    }
} 

But now I put the self inside the capture list of a PromiseKit call, the second PromiseKit call which is inside the first one (as the example above) doesn't warn me that I have to add .self.

Is this working for any closure inside the first closure with self in the capture list?

Great suggestion by the way!

1 Like