[SR-9215] Misleading error message when decoding a type #51704
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
definite initialization
diagnostics QoI
Bug: Diagnostics Quality of Implementation
Attachment: Download
Environment
macOS 10.14.1
Xcode 10.1
Swift 4.2
Additional Detail from JIRA
md5: 89ca81b994e4cea7c9dcfc0eacc09a78
Issue Description:
All,
I have encountered a misleading error message that kept me in debugging for a few minutes until I actually realized what's the problem.
I have simplified it down to this:
The problem is that I'm decoding a
.bar
keyed value into temporary variabletmpBar
that I'm later using to derive a realbar
value. And I usedfoo
instance variable to do that. However the error message tells me thatbar
was actually captured by a closure before being initialised. To fix I just had to do a local copy of instance variable that I was using inside map closure.Please find the compressed playground attached.
The text was updated successfully, but these errors were encountered: