|
7 | 7 |
|
8 | 8 | final class ObservableStateMacroTests: MacroBaseTestCase { |
9 | 9 | override func invokeTest() { |
10 | | - withMacroTesting { |
| 10 | + withMacroTesting( |
| 11 | + // record: .failed, |
| 12 | + ) { |
11 | 13 | super.invokeTest() |
12 | 14 | } |
13 | 15 | } |
|
35 | 37 | return _count |
36 | 38 | } |
37 | 39 | set { |
| 40 | + guard shouldNotifyObservers(_count, newValue) else { |
| 41 | + return |
| 42 | + } |
38 | 43 | _$observationRegistrar.mutate(self, keyPath: \.count, &_count, newValue, _$isIdentityEqual) |
39 | 44 | } |
40 | 45 | _modify { |
41 | 46 | let oldValue = _$observationRegistrar.willModify(self, keyPath: \.count, &_count) |
42 | | - defer { |
43 | | - _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
44 | | - } |
45 | 47 | yield &_count |
| 48 | + guard shouldNotifyObservers(oldValue, count) else { |
| 49 | + return |
| 50 | + } |
| 51 | + _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
46 | 52 | } |
47 | 53 | } |
48 | 54 |
|
|
55 | 61 | public mutating func _$willModify() { |
56 | 62 | _$observationRegistrar._$willModify() |
57 | 63 | } |
| 64 | +
|
| 65 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu_>(_ lhs: __macro_local_6MemberfMu_, _ rhs: __macro_local_6MemberfMu_) -> Bool { |
| 66 | + true |
| 67 | + } |
| 68 | +
|
| 69 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu0_: Equatable>(_ lhs: __macro_local_6MemberfMu0_, _ rhs: __macro_local_6MemberfMu0_) -> Bool { |
| 70 | + lhs != rhs |
| 71 | + } |
| 72 | +
|
| 73 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu1_: AnyObject>(_ lhs: __macro_local_6MemberfMu1_, _ rhs: __macro_local_6MemberfMu1_) -> Bool { |
| 74 | + lhs !== rhs |
| 75 | + } |
| 76 | +
|
| 77 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu2_: Equatable & AnyObject>(_ lhs: __macro_local_6MemberfMu2_, _ rhs: __macro_local_6MemberfMu2_) -> Bool { |
| 78 | + lhs != rhs |
| 79 | + } |
58 | 80 | } |
59 | 81 | """# |
60 | 82 | } |
|
81 | 103 | return _count |
82 | 104 | } |
83 | 105 | set { |
| 106 | + guard shouldNotifyObservers(_count, newValue) else { |
| 107 | + return |
| 108 | + } |
84 | 109 | _$observationRegistrar.mutate(self, keyPath: \.count, &_count, newValue, _$isIdentityEqual) |
85 | 110 | } |
86 | 111 | _modify { |
87 | 112 | let oldValue = _$observationRegistrar.willModify(self, keyPath: \.count, &_count) |
88 | | - defer { |
89 | | - _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
90 | | - } |
91 | 113 | yield &_count |
| 114 | + guard shouldNotifyObservers(oldValue, count) else { |
| 115 | + return |
| 116 | + } |
| 117 | + _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
92 | 118 | } |
93 | 119 | } |
94 | 120 |
|
|
101 | 127 | public mutating func _$willModify() { |
102 | 128 | _$observationRegistrar._$willModify() |
103 | 129 | } |
| 130 | +
|
| 131 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu_>(_ lhs: __macro_local_6MemberfMu_, _ rhs: __macro_local_6MemberfMu_) -> Bool { |
| 132 | + true |
| 133 | + } |
| 134 | +
|
| 135 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu0_: Equatable>(_ lhs: __macro_local_6MemberfMu0_, _ rhs: __macro_local_6MemberfMu0_) -> Bool { |
| 136 | + lhs != rhs |
| 137 | + } |
| 138 | +
|
| 139 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu1_: AnyObject>(_ lhs: __macro_local_6MemberfMu1_, _ rhs: __macro_local_6MemberfMu1_) -> Bool { |
| 140 | + lhs !== rhs |
| 141 | + } |
| 142 | +
|
| 143 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu2_: Equatable & AnyObject>(_ lhs: __macro_local_6MemberfMu2_, _ rhs: __macro_local_6MemberfMu2_) -> Bool { |
| 144 | + lhs != rhs |
| 145 | + } |
104 | 146 | } |
105 | 147 | """# |
106 | 148 | } |
|
127 | 169 | return _count |
128 | 170 | } |
129 | 171 | set { |
| 172 | + guard shouldNotifyObservers(_count, newValue) else { |
| 173 | + return |
| 174 | + } |
130 | 175 | _$observationRegistrar.mutate(self, keyPath: \.count, &_count, newValue, _$isIdentityEqual) |
131 | 176 | } |
132 | 177 | _modify { |
133 | 178 | let oldValue = _$observationRegistrar.willModify(self, keyPath: \.count, &_count) |
134 | | - defer { |
135 | | - _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
136 | | - } |
137 | 179 | yield &_count |
| 180 | + guard shouldNotifyObservers(oldValue, count) else { |
| 181 | + return |
| 182 | + } |
| 183 | + _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
138 | 184 | } |
139 | 185 | } |
140 | 186 |
|
|
147 | 193 | public mutating func _$willModify() { |
148 | 194 | _$observationRegistrar._$willModify() |
149 | 195 | } |
| 196 | +
|
| 197 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu_>(_ lhs: __macro_local_6MemberfMu_, _ rhs: __macro_local_6MemberfMu_) -> Bool { |
| 198 | + true |
| 199 | + } |
| 200 | +
|
| 201 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu0_: Equatable>(_ lhs: __macro_local_6MemberfMu0_, _ rhs: __macro_local_6MemberfMu0_) -> Bool { |
| 202 | + lhs != rhs |
| 203 | + } |
| 204 | +
|
| 205 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu1_: AnyObject>(_ lhs: __macro_local_6MemberfMu1_, _ rhs: __macro_local_6MemberfMu1_) -> Bool { |
| 206 | + lhs !== rhs |
| 207 | + } |
| 208 | +
|
| 209 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu2_: Equatable & AnyObject>(_ lhs: __macro_local_6MemberfMu2_, _ rhs: __macro_local_6MemberfMu2_) -> Bool { |
| 210 | + lhs != rhs |
| 211 | + } |
150 | 212 | } |
151 | 213 | """# |
152 | 214 | } |
|
170 | 232 | return _count |
171 | 233 | } |
172 | 234 | set { |
| 235 | + guard shouldNotifyObservers(_count, newValue) else { |
| 236 | + return |
| 237 | + } |
173 | 238 | _$observationRegistrar.mutate(self, keyPath: \.count, &_count, newValue, _$isIdentityEqual) |
174 | 239 | } |
175 | 240 | _modify { |
176 | 241 | let oldValue = _$observationRegistrar.willModify(self, keyPath: \.count, &_count) |
177 | | - defer { |
178 | | - _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
179 | | - } |
180 | 242 | yield &_count |
| 243 | + guard shouldNotifyObservers(oldValue, count) else { |
| 244 | + return |
| 245 | + } |
| 246 | + _$observationRegistrar.didModify(self, keyPath: \.count, &_count, oldValue, _$isIdentityEqual) |
181 | 247 | } |
182 | 248 | } |
183 | 249 |
|
|
190 | 256 | public mutating func _$willModify() { |
191 | 257 | _$observationRegistrar._$willModify() |
192 | 258 | } |
| 259 | +
|
| 260 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu_>(_ lhs: __macro_local_6MemberfMu_, _ rhs: __macro_local_6MemberfMu_) -> Bool { |
| 261 | + true |
| 262 | + } |
| 263 | +
|
| 264 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu0_: Equatable>(_ lhs: __macro_local_6MemberfMu0_, _ rhs: __macro_local_6MemberfMu0_) -> Bool { |
| 265 | + lhs != rhs |
| 266 | + } |
| 267 | +
|
| 268 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu1_: AnyObject>(_ lhs: __macro_local_6MemberfMu1_, _ rhs: __macro_local_6MemberfMu1_) -> Bool { |
| 269 | + lhs !== rhs |
| 270 | + } |
| 271 | +
|
| 272 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu2_: Equatable & AnyObject>(_ lhs: __macro_local_6MemberfMu2_, _ rhs: __macro_local_6MemberfMu2_) -> Bool { |
| 273 | + lhs != rhs |
| 274 | + } |
193 | 275 | } |
194 | 276 | """# |
195 | 277 | } |
|
218 | 300 | public mutating func _$willModify() { |
219 | 301 | _$observationRegistrar._$willModify() |
220 | 302 | } |
| 303 | +
|
| 304 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu_>(_ lhs: __macro_local_6MemberfMu_, _ rhs: __macro_local_6MemberfMu_) -> Bool { |
| 305 | + true |
| 306 | + } |
| 307 | +
|
| 308 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu0_: Equatable>(_ lhs: __macro_local_6MemberfMu0_, _ rhs: __macro_local_6MemberfMu0_) -> Bool { |
| 309 | + lhs != rhs |
| 310 | + } |
| 311 | +
|
| 312 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu1_: AnyObject>(_ lhs: __macro_local_6MemberfMu1_, _ rhs: __macro_local_6MemberfMu1_) -> Bool { |
| 313 | + lhs !== rhs |
| 314 | + } |
| 315 | +
|
| 316 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu2_: Equatable & AnyObject>(_ lhs: __macro_local_6MemberfMu2_, _ rhs: __macro_local_6MemberfMu2_) -> Bool { |
| 317 | + lhs != rhs |
| 318 | + } |
221 | 319 | } |
222 | 320 | """ |
223 | 321 | } |
|
673 | 771 | public mutating func _$willModify() { |
674 | 772 | _$observationRegistrar._$willModify() |
675 | 773 | } |
| 774 | +
|
| 775 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu_>(_ lhs: __macro_local_6MemberfMu_, _ rhs: __macro_local_6MemberfMu_) -> Bool { |
| 776 | + true |
| 777 | + } |
| 778 | +
|
| 779 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu0_: Equatable>(_ lhs: __macro_local_6MemberfMu0_, _ rhs: __macro_local_6MemberfMu0_) -> Bool { |
| 780 | + lhs != rhs |
| 781 | + } |
| 782 | +
|
| 783 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu1_: AnyObject>(_ lhs: __macro_local_6MemberfMu1_, _ rhs: __macro_local_6MemberfMu1_) -> Bool { |
| 784 | + lhs !== rhs |
| 785 | + } |
| 786 | +
|
| 787 | + private nonisolated func shouldNotifyObservers<__macro_local_6MemberfMu2_: Equatable & AnyObject>(_ lhs: __macro_local_6MemberfMu2_, _ rhs: __macro_local_6MemberfMu2_) -> Bool { |
| 788 | + lhs != rhs |
| 789 | + } |
676 | 790 | } |
677 | 791 | """ |
678 | 792 | } |
|
0 commit comments