[SR-2329] self unavailable in closures to initialize lazy properties unless type specified #44936
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Environment
swift-DEVELOPMENT-SNAPSHOT-2016-08-07-a.xctoolchain on Mac OS X 10.11.6
Additional Detail from JIRA
md5: b81de81480504c635ad77aba95f15343
duplicates:
self
doesn't work in initializer of lazy varrelates to:
Issue Description:
Self is unavailable in closures used to initialize lazy properties unless the type of that property is explicitly stated. Consider this code:
The closure used to initialize a works fine. But for the closure for b we get the error message "error: use of unresolved identifier 'self'".
This also happens if the type of the closure is not needed to infer the type of the lazy property, for example as in
Here again a is fine, but in b the error message appears.
The text was updated successfully, but these errors were encountered: