Files
swift-mirror/test/SILGen/Inputs/lazy_properties_other.swift
Slava Pestov 6d6fba5757 Sema: Don't visit local types when computing captures
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>.
2019-10-01 21:01:31 -04:00

15 lines
209 B
Swift

public class C2 {
public final func f() {
func local() {
_ = {
class Local {
lazy var a = {
return b
}()
var b = 123
}
}
}
}
}