Skip to content

Commit 8f7356f

Browse files
authored
Merge pull request #3275 from apple/stdlib-add-persistent-vector-prototype
2 parents b15f816 + b8ba955 commit 8f7356f

File tree

2 files changed

+2226
-2
lines changed

2 files changed

+2226
-2
lines changed

stdlib/private/StdlibUnittest/MinimalTypes.swift.gyb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ public struct ${Self} : Equatable, Hashable {
114114
public static var timesEqualEqualWasCalled: Int = 0
115115
public static var timesHashValueWasCalled: Int = 0
116116

117+
public static var equalImpl =
118+
ResettableValue<(Int, Int) -> Bool>({ $0 == $1 })
119+
public static var hashValueImpl =
120+
ResettableValue<(Int) -> Int>({ $0.hashValue })
121+
117122
public var value: Int
118123
public var identity: Int
119124

@@ -129,7 +134,7 @@ public struct ${Self} : Equatable, Hashable {
129134

130135
public var hashValue: Int {
131136
${Self}.timesHashValueWasCalled += 1
132-
return value.hashValue
137+
return ${Self}.hashValueImpl.value(value)
133138
}
134139
}
135140

@@ -138,7 +143,7 @@ public func == (
138143
rhs: ${Self}
139144
) -> Bool {
140145
${Self}.timesEqualEqualWasCalled += 1
141-
return lhs.value == rhs.value
146+
return ${Self}.equalImpl.value(lhs.value, rhs.value)
142147
}
143148

144149
% end

0 commit comments

Comments
 (0)