Skip to content

Commit ff1cf91

Browse files
authored
Fix some variable names in #310. (#313)
This PR fixes some poor variable names I picked in #310. It also optimizes the `==` operator a bit by using the stored FQN instead of computed FQN components. Finally, it fixes `hash(into:)` producing different hashes depending on the kind case (oops.) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent aadbd25 commit ff1cf91

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

Sources/Testing/Parameterization/TypeInfo.swift

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public struct TypeInfo: Sendable {
5151
switch _kind {
5252
case let .type(type):
5353
nameComponents(of: type)
54-
case let .nameOnly(fqn, _):
55-
fqn.split(separator: ".").map(String.init)
54+
case let .nameOnly(fullyQualifiedName, _):
55+
fullyQualifiedName.split(separator: ".").map(String.init)
5656
}
5757
}
5858

@@ -74,8 +74,8 @@ public struct TypeInfo: Sendable {
7474
switch _kind {
7575
case let .type(type):
7676
Testing.fullyQualifiedName(of: type)
77-
case let .nameOnly(fqn, _):
78-
fqn
77+
case let .nameOnly(fullyQualifiedName, _):
78+
fullyQualifiedName
7979
}
8080
}
8181

@@ -154,17 +154,12 @@ extension TypeInfo: Hashable {
154154
case let (.type(lhs), .type(rhs)):
155155
return lhs == rhs
156156
default:
157-
return lhs.fullyQualifiedNameComponents == rhs.fullyQualifiedNameComponents
157+
return lhs.fullyQualifiedName == rhs.fullyQualifiedName
158158
}
159159
}
160160

161161
public func hash(into hasher: inout Hasher) {
162-
switch _kind {
163-
case let .type(type):
164-
hasher.combine(ObjectIdentifier(type))
165-
case let .nameOnly(fqnComponents, _):
166-
hasher.combine(fqnComponents)
167-
}
162+
hasher.combine(fullyQualifiedName)
168163
}
169164
}
170165

0 commit comments

Comments
 (0)