mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Ordinarily in valid code, pattern binding initializers in local types cannot capture anything from the outer scope. However one exception is lazy property initializers, which can reference the lazy property initializer context's 'self' parameter. If we computed captures for the outer function before synthesizing the lazy property getter, we would think that the 'self' parameter was a capture of the outer function, with hilarious results. Fixes <rdar://problem/54712320>.
15 lines
209 B
Swift
15 lines
209 B
Swift
public class C2 {
|
|
public final func f() {
|
|
func local() {
|
|
_ = {
|
|
class Local {
|
|
lazy var a = {
|
|
return b
|
|
}()
|
|
var b = 123
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|