[PR #191] [MERGED] Corrected type-checking in fetchExisting to preserve input type #473

Closed
opened 2025-12-29 15:32:30 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/JohnEstropia/CoreStore/pull/191
Author: @sidmani
Created: 8/16/2017
Status: Merged
Merged: 8/16/2017
Merged by: @JohnEstropia

Base: prototype/Swift_4_0Head: prototype/Swift_4_0


📝 Commits (1)

  • c89bc3c Corrected type-checking in fetchExisting to preserve input type

📊 Changes

1 file changed (+3 additions, -1 deletions)

View changed files

📝 Sources/NSManagedObjectContext+Querying.swift (+3 -1)

📄 Description

Turns out the problem in #190 was very simple to fix- instead of using T, the type of the object passed to fetchExisting, use type(of:) to get the dynamic type at runtime and properly instantiate the result. The change shouldn't affect any existing projects that use the method since the return type is unchanged.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/JohnEstropia/CoreStore/pull/191 **Author:** [@sidmani](https://github.com/sidmani) **Created:** 8/16/2017 **Status:** ✅ Merged **Merged:** 8/16/2017 **Merged by:** [@JohnEstropia](https://github.com/JohnEstropia) **Base:** `prototype/Swift_4_0` ← **Head:** `prototype/Swift_4_0` --- ### 📝 Commits (1) - [`c89bc3c`](https://github.com/JohnEstropia/CoreStore/commit/c89bc3c22712f660864ff22c469c7987c4749b0d) Corrected type-checking in fetchExisting to preserve input type ### 📊 Changes **1 file changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `Sources/NSManagedObjectContext+Querying.swift` (+3 -1) </details> ### 📄 Description Turns out the problem in #190 was very simple to fix- instead of using T, the type of the object passed to fetchExisting, use type(of:) to get the dynamic type at runtime and properly instantiate the result. The change shouldn't affect any existing projects that use the method since the return type is unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 15:32:30 +01:00
adam closed this issue 2025-12-29 15:32:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#473