mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
If we computed captures before completing a lazy getter body, we would fail to consider the 'self' capture properly. Instead make it resilient to such ordering issues by checking in capture computation if the lazy property has a getter yet or not.
13 lines
168 B
Swift
13 lines
168 B
Swift
public struct Test1 {
|
|
lazy var property: String = "help"
|
|
}
|
|
|
|
public class Test2 {
|
|
var x = 0
|
|
var y = 1
|
|
|
|
lazy var property = {
|
|
return [self.x, self.y]
|
|
}()
|
|
}
|