You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I rely upon a closure for type erasure at a different layer.
When I set a breakpoint and inspect the variable at each level, it is valid at the top of the call stack, as it goes down into closures the memory gets disassociated and I can no longer inspect the value.
In Swift 5.x, the closure and method dispatch do not crash, but the evaluation is incorrect.
If I use a typealias, then everything works as expected.
I have a cleanly compiling project with clean unit tests.
When I apply the attached patch, I would expect the same to be true.
What happens today is everything compiles, but some unit tests fail.
If I set a breakpoint in `FetchedResultsControllerTestCase.testExpectNoInsertFromBroadcastNotification()`, on line 887, the json parameter is believed to be of case `number`.
Printing the description, it's clear that something was misassigned:
Printing description of json: ▿ JSON
{{ - number : TtGCs18_DictionaryStorageSSP_$}}
If I walk up the call stack to FetchedResultsController.observedObjectUpdate(_🙂 on line 987, it's of case `dictionary`.
The intermediate thunks caused this memory corruption.
Attachment: Download
Environment
Swift 5.x on Apple platforms
Additional Detail from JIRA
md5: 70765ca8f079ddb30954d57fcaa981bb
Issue Description:
I rely upon a closure for type erasure at a different layer.
When I set a breakpoint and inspect the variable at each level, it is valid at the top of the call stack, as it goes down into closures the memory gets disassociated and I can no longer inspect the value.
In Swift 5.x, the closure and method dispatch do not crash, but the evaluation is incorrect.
If I use a typealias, then everything works as expected.
I have a cleanly compiling project with clean unit tests.
When I apply the attached patch, I would expect the same to be true.
What happens today is everything compiles, but some unit tests fail.
https://github.com/crewos/fetchrequests
--
This has not worked in most versions of Swift.
In at least one version it had worked – I think the swift 4 betas.
In prior versions of Swift the evaluation would crash.
In Swift 5.x it does not crash, but the pointer addresses are invalid.
In the past, the RawData type was a [String: Any], which had the same problems.
The text was updated successfully, but these errors were encountered: