Skip to content

[gardening]: remove unneeded code from ChildKey #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions Workflow/Sources/SubtreeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -404,23 +404,16 @@ extension WorkflowNode.SubtreeManager {

extension WorkflowNode.SubtreeManager {
struct ChildKey: Hashable {
var childType: Any.Type
var childTypeID: ObjectIdentifier
var key: String

init(childType: (some Any).Type, key: String) {
self.childType = childType
init(
childType: (some Workflow).Type,
key: String
) {
self.childTypeID = ObjectIdentifier(childType)
self.key = key
}

func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(childType))
hasher.combine(key)
}

static func == (lhs: ChildKey, rhs: ChildKey) -> Bool {
lhs.childType == rhs.childType
&& lhs.key == rhs.key
}
Comment on lines -415 to -423
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we get these for free if all our stored properties are Hashable

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may find this wrapper useful to do the same thing with better debugging/logging

}
}

Expand Down
Loading