swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.49k stars 10.35k forks source link

[SR-10081] Using identity key path is not reliable for core data predicates/expressions #52483

Open swift-ci opened 5 years ago

swift-ci commented 5 years ago
Previous ID SR-10081
Radar rdar://problem/48980810
Original Reporter sisoje (JIRA User)
Type Bug
Environment XCode 10.2 beta 4, Swift 5, iPhone Xr simulator.
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Standard Library | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: f2e8ed7c7d98130934e4b2282b123693

Issue Description:

I made some snippets here:

https://gist.github.com/sisoje/a9226fc4c00613cc62648140480783ef

Crash occurs only when we use identity key path.

Expression using "expressionForEvaluatedObject" always works well.

I expected that identity key path works the same as "expressionForEvaluatedObject" but it isn't the case.

belkadan commented 5 years ago

cc @jckarter. Is this a failure of key paths or CoreData?

jckarter commented 5 years ago

I'm not sure. The identity key path ought to bridge over to the @"self" key path in Cocoa KVC. I'm not sure whether Core Data handles that.