mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[TypeChecker] Avoid checking lazy property accessors if they haven't been synthesized yet
Ttheir availability is going to match the property itself. This is a workaround for lazy type-checking because synthesis of accessors for such properties requires a reference to `self` which won't be available because pattern binding for the variable was skipped. Resolves: rdar://129359362 Resolves: rdar://159463230 Resolves: https://github.com/swiftlang/swift/issues/84041
This commit is contained in:
@@ -402,3 +402,7 @@ extension PublicStruct {
|
||||
lhs = rhs
|
||||
}
|
||||
}
|
||||
|
||||
public class LazyPropertyWithClosureType {
|
||||
public lazy var lazyVar: Int = { 2 }()
|
||||
}
|
||||
|
||||
@@ -142,3 +142,8 @@ func testOperators() {
|
||||
var a: PublicStruct
|
||||
a <<< PublicStruct(x: 2)
|
||||
}
|
||||
|
||||
func testLazyPropertyWithInitClosureReference(t: LazyPropertyWithClosureType) {
|
||||
_ = t.lazyVar
|
||||
t.lazyVar = 42
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user