Skip to content

Commit 8428d4a

Browse files
authored
Migrate null, numbers, and GeoPoints to FSTDelegateValue (#3044)
* Migrate FSTNullValue to FSTDelegateValue * Migrate FSTIntegerValue to FSTDelegateValue * Migrate FSTDoubleValue to FSTDelegateValue * Migrate FSTGeoPointValue to FSTDelegateValue
1 parent 00ff0f2 commit 8428d4a

File tree

16 files changed

+123
-342
lines changed

16 files changed

+123
-342
lines changed

Firestore/Example/Tests/API/FSTUserDataConverterTests.mm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ - (void)testConvertsIntegers {
4141
];
4242
for (id value in values) {
4343
FSTFieldValue *wrapped = FSTTestFieldValue(value);
44-
XCTAssertEqualObjects([wrapped class], [FSTIntegerValue class]);
44+
XCTAssertEqualObjects([wrapped class], [FSTDelegateValue class]);
4545
XCTAssertEqualObjects([wrapped value], @([value longLongValue]));
4646
XCTAssertEqual(wrapped.type, FieldValue::Type::Integer);
4747
}
@@ -56,17 +56,17 @@ - (void)testConvertsDoubles {
5656
];
5757
for (id value in values) {
5858
FSTFieldValue *wrapped = FSTTestFieldValue(value);
59-
XCTAssertEqualObjects([wrapped class], [FSTDoubleValue class]);
59+
XCTAssertEqualObjects([wrapped class], [FSTDelegateValue class]);
6060
XCTAssertEqualObjects([wrapped value], value);
6161
XCTAssertEqual(wrapped.type, FieldValue::Type::Double);
6262
}
6363
}
6464

6565
- (void)testConvertsNilAndNSNull {
66-
FSTNullValue *nullValue = [FSTNullValue nullValue];
67-
XCTAssertEqual(FSTTestFieldValue(nil), nullValue);
68-
XCTAssertEqual(FSTTestFieldValue([NSNull null]), nullValue);
69-
XCTAssertEqual([nullValue value], [NSNull null]);
66+
FSTFieldValue *nullValue = FieldValue::Null().Wrap();
67+
XCTAssertEqualObjects(FSTTestFieldValue(nil), nullValue);
68+
XCTAssertEqualObjects(FSTTestFieldValue([NSNull null]), nullValue);
69+
XCTAssertEqualObjects([nullValue value], [NSNull null]);
7070
XCTAssertEqual(nullValue.type, FieldValue::Type::Null);
7171
}
7272

@@ -87,7 +87,7 @@ - (void)testConvertsUnsignedCharToInteger {
8787
// choose, and it's more useful to support shorts as Integers than it is to treat unsigned char as
8888
// Boolean.
8989
FSTFieldValue *wrapped = FSTTestFieldValue([NSNumber numberWithUnsignedChar:1]);
90-
XCTAssertEqualObjects(wrapped, [FSTIntegerValue integerValue:1]);
90+
XCTAssertEqualObjects(wrapped, FieldValue::FromInteger(1).Wrap());
9191
}
9292

9393
union DoubleBits {
@@ -121,7 +121,7 @@ - (void)testConvertsGeoPoints {
121121

122122
for (id value in values) {
123123
FSTFieldValue *wrapped = FSTTestFieldValue(value);
124-
XCTAssertEqualObjects([wrapped class], [FSTGeoPointValue class]);
124+
XCTAssertEqualObjects([wrapped class], [FSTDelegateValue class]);
125125
XCTAssertEqualObjects([wrapped value], value);
126126
XCTAssertEqual(wrapped.type, FieldValue::Type::GeoPoint);
127127
}
@@ -161,9 +161,9 @@ - (void)testConvertsSimpleObjects {
161161
FSTTestObjectValue(@{@"a" : @"foo", @"b" : @(1L), @"c" : @YES, @"d" : [NSNull null]});
162162
FSTObjectValue *expected = [[FSTObjectValue alloc] initWithDictionary:@{
163163
@"a" : FieldValue::FromString("foo").Wrap(),
164-
@"b" : [FSTIntegerValue integerValue:1LL],
164+
@"b" : FieldValue::FromInteger(1).Wrap(),
165165
@"c" : FieldValue::True().Wrap(),
166-
@"d" : [FSTNullValue nullValue]
166+
@"d" : FieldValue::Null().Wrap()
167167
}];
168168
XCTAssertEqualObjects(actual, expected);
169169
XCTAssertEqual(actual.type, FieldValue::Type::Object);

Firestore/Example/Tests/Core/FSTViewTests.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
using firebase::firestore::model::ResourcePath;
4545
using firebase::firestore::model::DocumentKeySet;
4646
using firebase::firestore::model::DocumentSet;
47+
using firebase::firestore::model::FieldValue;
4748
using testing::ElementsAre;
4849

4950
NS_ASSUME_NONNULL_BEGIN
@@ -173,7 +174,7 @@ - (void)testFiltersDocumentsBasedOnQueryWithFilter {
173174
FSTQuery *query = [self queryForMessages];
174175
FSTRelationFilter *filter = [FSTRelationFilter filterWithField:testutil::Field("sort")
175176
filterOperator:Filter::Operator::LessThanOrEqual
176-
value:[FSTDoubleValue doubleValue:2]];
177+
value:FieldValue::FromDouble(2).Wrap()];
177178
query = [query queryByAddingFilter:filter];
178179

179180
FSTView *view = [[FSTView alloc] initWithQuery:query remoteDocuments:DocumentKeySet{}];
@@ -211,7 +212,7 @@ - (void)testUpdatesDocumentsBasedOnQueryWithFilter {
211212
FSTQuery *query = [self queryForMessages];
212213
FSTRelationFilter *filter = [FSTRelationFilter filterWithField:testutil::Field("sort")
213214
filterOperator:Filter::Operator::LessThanOrEqual
214-
value:[FSTDoubleValue doubleValue:2]];
215+
value:FieldValue::FromDouble(2).Wrap()];
215216
query = [query queryByAddingFilter:filter];
216217

217218
FSTView *view = [[FSTView alloc] initWithQuery:query remoteDocuments:DocumentKeySet{}];

Firestore/Example/Tests/Model/FSTFieldValueTests.mm

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626
#import "Firestore/Example/Tests/API/FSTAPIHelpers.h"
2727
#import "Firestore/Example/Tests/Util/FSTHelpers.h"
2828

29+
#include "Firestore/core/include/firebase/firestore/geo_point.h"
2930
#include "Firestore/core/src/firebase/firestore/model/database_id.h"
3031
#include "Firestore/core/src/firebase/firestore/model/field_value.h"
3132
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
3233
#include "Firestore/core/test/firebase/firestore/testutil/testutil.h"
3334

3435
namespace testutil = firebase::firestore::testutil;
3536
namespace util = firebase::firestore::util;
37+
using firebase::firestore::GeoPoint;
3638
using firebase::firestore::model::DatabaseId;
3739
using firebase::firestore::model::FieldValue;
3840

@@ -123,22 +125,22 @@ - (void)testNormalizesNaNs {
123125
// Ensure we get the same normalization behavior (currently implemented explicitly by checking
124126
// for isnan() and then explicitly assigning NAN).
125127
union DoubleBits result;
126-
result.d = [[FSTDoubleValue doubleValue:canonical.d] internalValue];
128+
result.d = FieldValue::FromDouble(canonical.d).double_value();
127129
XCTAssertEqual(result.bits, canonical.bits);
128130

129-
result.d = [[FSTDoubleValue doubleValue:alternate.d] internalValue];
131+
result.d = FieldValue::FromDouble(alternate.d).double_value();
130132
XCTAssertEqual(result.bits, canonical.bits);
131133

132134
// A NaN that's canonical except it has the sign bit set (would be negative if signs mattered)
133135
union DoubleBits negative = {.bits = 0xfff8000000000000ULL};
134-
result.d = [[FSTDoubleValue doubleValue:negative.d] internalValue];
136+
result.d = FieldValue::FromDouble(negative.d).double_value();
135137
XCTAssertTrue(isnan(negative.d));
136138
XCTAssertEqual(result.bits, canonical.bits);
137139

138140
// A signaling NaN with significand where MSB is 0, and some non-MSB bit is one.
139141
union DoubleBits signaling = {.bits = 0xfff4000000000000ULL};
140142
XCTAssertTrue(isnan(signaling.d));
141-
result.d = [[FSTDoubleValue doubleValue:signaling.d] internalValue];
143+
result.d = FieldValue::FromDouble(signaling.d).double_value();
142144
XCTAssertEqual(result.bits, canonical.bits);
143145
}
144146

@@ -157,15 +159,15 @@ - (void)testZeros {
157159
XCTAssertEqual(normalized.bits, negativeZero.bits);
158160
XCTAssertEqualObjects([NSNumber numberWithDouble:0.0], [NSNumber numberWithDouble:-0.0]);
159161

160-
// FSTDoubleValue preserves positive/negative zero
162+
// FieldValue::FromDouble preserves positive/negative zero
161163
union DoubleBits result;
162-
result.d = [[[FSTDoubleValue doubleValue:zero.d] value] doubleValue];
164+
result.d = FieldValue::FromDouble(zero.d).double_value();
163165
XCTAssertEqual(result.bits, zero.bits);
164-
result.d = [[[FSTDoubleValue doubleValue:negativeZero.d] value] doubleValue];
166+
result.d = FieldValue::FromDouble(negativeZero.d).double_value();
165167
XCTAssertEqual(result.bits, negativeZero.bits);
166168

167169
// ... but compares positive/negative zero as unequal, compatibly with Firestore.
168-
XCTAssertNotEqualObjects([FSTDoubleValue doubleValue:0.0], [FSTDoubleValue doubleValue:-0.0]);
170+
XCTAssertNotEqual(FieldValue::FromDouble(0.0), FieldValue::FromDouble(-0.0));
169171
}
170172

171173
- (void)testExtractsFields {
@@ -288,14 +290,14 @@ - (void)testValueEquality {
288290
NSArray *groups = @[
289291
@[ FSTTestFieldValue(@YES), FieldValue::True().Wrap() ],
290292
@[ FSTTestFieldValue(@NO), FieldValue::False().Wrap() ],
291-
@[ FSTTestFieldValue([NSNull null]), [FSTNullValue nullValue] ],
292-
@[ FSTTestFieldValue(@(0.0 / 0.0)), FSTTestFieldValue(@(NAN)), [FSTDoubleValue nanValue] ],
293+
@[ FSTTestFieldValue([NSNull null]), FieldValue::Null().Wrap() ],
294+
@[ FSTTestFieldValue(@(0.0 / 0.0)), FSTTestFieldValue(@(NAN)), FieldValue::Nan().Wrap() ],
293295
// -0.0 and 0.0 compare: the same (but are not isEqual:)
294296
@[ FSTTestFieldValue(@(-0.0)) ], @[ FSTTestFieldValue(@0.0) ],
295-
@[ FSTTestFieldValue(@1), FSTTestFieldValue(@1LL), [FSTIntegerValue integerValue:1LL] ],
297+
@[ FSTTestFieldValue(@1), FSTTestFieldValue(@1LL), FieldValue::FromInteger(1LL).Wrap() ],
296298
// double and unit64_t values can compare: the same (but won't be isEqual:)
297-
@[ FSTTestFieldValue(@1.0), [FSTDoubleValue doubleValue:1.0] ],
298-
@[ FSTTestFieldValue(@1.1), [FSTDoubleValue doubleValue:1.1] ],
299+
@[ FSTTestFieldValue(@1.0), FieldValue::FromDouble(1.0).Wrap() ],
300+
@[ FSTTestFieldValue(@1.1), FieldValue::FromDouble(1.1).Wrap() ],
299301
@[
300302
FSTTestFieldValue(FSTTestData(0, 1, 2, -1)), [FSTBlobValue blobValue:FSTTestData(0, 1, 2, -1)]
301303
],
@@ -323,7 +325,7 @@ - (void)testValueEquality {
323325
previousValue:nil] ],
324326
@[
325327
FSTTestFieldValue(FSTTestGeoPoint(0, 1)),
326-
[FSTGeoPointValue geoPointValue:FSTTestGeoPoint(0, 1)]
328+
FieldValue::FromGeoPoint(GeoPoint(0, 1)).Wrap()
327329
],
328330
@[ FSTTestFieldValue(FSTTestGeoPoint(1, 0)) ],
329331
@[

Firestore/Example/Tests/Model/FSTMutationTests.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
3232
#include "Firestore/core/src/firebase/firestore/model/field_mask.h"
3333
#include "Firestore/core/src/firebase/firestore/model/field_transform.h"
34+
#include "Firestore/core/src/firebase/firestore/model/field_value.h"
3435
#include "Firestore/core/src/firebase/firestore/model/precondition.h"
3536
#include "Firestore/core/src/firebase/firestore/model/transform_operations.h"
3637
#include "Firestore/core/test/firebase/firestore/testutil/testutil.h"
@@ -41,6 +42,7 @@
4142
using firebase::firestore::model::FieldMask;
4243
using firebase::firestore::model::FieldPath;
4344
using firebase::firestore::model::FieldTransform;
45+
using firebase::firestore::model::FieldValue;
4446
using firebase::firestore::model::Precondition;
4547
using firebase::firestore::model::TransformOperation;
4648

@@ -420,7 +422,7 @@ - (void)testAppliesServerAckedIncrementTransformToDocuments {
420422

421423
FSTMutationResult *mutationResult =
422424
[[FSTMutationResult alloc] initWithVersion:testutil::Version(1)
423-
transformResults:@[ [FSTIntegerValue integerValue:3] ]];
425+
transformResults:@[ FieldValue::FromInteger(3).Wrap() ]];
424426

425427
FSTMaybeDocument *transformedDoc = [transform applyToRemoteDocument:baseDoc
426428
mutationResult:mutationResult];
@@ -461,7 +463,7 @@ - (void)testAppliesServerAckedArrayTransformsToDocuments {
461463
// Server just sends null transform results for array operations.
462464
FSTMutationResult *mutationResult = [[FSTMutationResult alloc]
463465
initWithVersion:testutil::Version(1)
464-
transformResults:@[ [FSTNullValue nullValue], [FSTNullValue nullValue] ]];
466+
transformResults:@[ FieldValue::Null().Wrap(), FieldValue::Null().Wrap() ]];
465467

466468
FSTMaybeDocument *transformedDoc = [transform applyToRemoteDocument:baseDoc
467469
mutationResult:mutationResult];

Firestore/Example/Tests/Remote/FSTSerializerBetaTests.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ - (void)setUp {
145145
}
146146

147147
- (void)testEncodesNull {
148-
FSTFieldValue *model = [FSTNullValue nullValue];
148+
FSTFieldValue *model = FieldValue::Null().Wrap();
149149

150150
GCFSValue *proto = [GCFSValue message];
151151
proto.nullValue = GPBNullValue_NullValue;

Firestore/Source/API/FIRGeoPoint+Internal.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,21 @@
1818

1919
NS_ASSUME_NONNULL_BEGIN
2020

21+
namespace firebase {
22+
namespace firestore {
23+
class GeoPoint;
24+
} // namespace firestore
25+
} // namespace firebase
26+
27+
namespace firestore = firebase::firestore;
28+
2129
/** Internal FIRGeoPoint API we don't want exposed in our public header files. */
2230
@interface FIRGeoPoint (Internal)
31+
2332
- (NSComparisonResult)compare:(FIRGeoPoint *)other;
33+
34+
- (firestore::GeoPoint)toGeoPoint;
35+
2436
@end
2537

2638
NS_ASSUME_NONNULL_END

Firestore/Source/API/FIRGeoPoint.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#import "Firestore/Source/API/FIRGeoPoint+Internal.h"
1818

19+
#include "Firestore/core/include/firebase/firestore/geo_point.h"
1920
#include "Firestore/core/src/firebase/firestore/api/input_validation.h"
2021
#include "Firestore/core/src/firebase/firestore/util/comparison.h"
2122

@@ -85,4 +86,12 @@ - (id)copyWithZone:(NSZone *_Nullable)zone {
8586

8687
@end
8788

89+
@implementation FIRGeoPoint (Internal)
90+
91+
- (firestore::GeoPoint)toGeoPoint {
92+
return firestore::GeoPoint(self.latitude, self.longitude);
93+
}
94+
95+
@end
96+
8897
NS_ASSUME_NONNULL_END

Firestore/Source/API/FSTUserDataConverter.mm

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#import "Firestore/Source/API/FIRFieldPath+Internal.h"
3030
#import "Firestore/Source/API/FIRFieldValue+Internal.h"
3131
#import "Firestore/Source/API/FIRFirestore+Internal.h"
32+
#import "Firestore/Source/API/FIRGeoPoint+Internal.h"
3233
#import "Firestore/Source/Model/FSTFieldValue.h"
3334
#import "Firestore/Source/Model/FSTMutation.h"
3435

@@ -289,7 +290,7 @@ - (FSTFieldValue *)parseArray:(NSArray *)array context:(ParseContext &&)context
289290
FSTFieldValue *_Nullable parsedEntry = [self parseData:entry context:context.ChildContext(idx)];
290291
if (!parsedEntry) {
291292
// Just include nulls in the array for fields being replaced with a sentinel.
292-
parsedEntry = [FSTNullValue nullValue];
293+
parsedEntry = FieldValue::Null().Wrap();
293294
}
294295
[result addObject:parsedEntry];
295296
}];
@@ -350,8 +351,7 @@ - (void)parseSentinelFieldValue:(FIRFieldValue *)fieldValue context:(ParseContex
350351
} else if ([fieldValue isKindOfClass:[FSTNumericIncrementFieldValue class]]) {
351352
FSTNumericIncrementFieldValue *numericIncrementFieldValue =
352353
(FSTNumericIncrementFieldValue *)fieldValue;
353-
FSTNumberValue *operand =
354-
(FSTNumberValue *)[self parsedQueryValue:numericIncrementFieldValue.operand];
354+
FSTFieldValue *operand = [self parsedQueryValue:numericIncrementFieldValue.operand];
355355
auto numeric_increment = absl::make_unique<NumericIncrementTransform>(operand);
356356

357357
context.AddToFieldTransforms(*context.path(), std::move(numeric_increment));
@@ -373,7 +373,7 @@ - (void)parseSentinelFieldValue:(FIRFieldValue *)fieldValue context:(ParseContex
373373
*/
374374
- (nullable FSTFieldValue *)parseScalarValue:(nullable id)input context:(ParseContext &&)context {
375375
if (!input || [input isMemberOfClass:[NSNull class]]) {
376-
return [FSTNullValue nullValue];
376+
return FieldValue::Null().Wrap();
377377

378378
} else if ([input isKindOfClass:[NSNumber class]]) {
379379
// Recover the underlying type of the number, using the method described here:
@@ -385,7 +385,7 @@ - (nullable FSTFieldValue *)parseScalarValue:(nullable id)input context:(ParseCo
385385
// Articles/ocrtTypeEncodings.html
386386
switch (cType[0]) {
387387
case 'q':
388-
return [FSTIntegerValue integerValue:[input longLongValue]];
388+
return FieldValue::FromInteger([input longLongValue]).Wrap();
389389

390390
case 'i': // Falls through.
391391
case 's': // Falls through.
@@ -394,7 +394,7 @@ - (nullable FSTFieldValue *)parseScalarValue:(nullable id)input context:(ParseCo
394394
case 'S':
395395
// Coerce integer values that aren't long long. Allow unsigned integer types that are
396396
// guaranteed small enough to skip a length check.
397-
return [FSTIntegerValue integerValue:[input longLongValue]];
397+
return FieldValue::FromInteger([input longLongValue]).Wrap();
398398

399399
case 'L': // Falls through.
400400
case 'Q':
@@ -408,19 +408,19 @@ - (nullable FSTFieldValue *)parseScalarValue:(nullable id)input context:(ParseCo
408408
context.FieldDescription());
409409

410410
} else {
411-
return [FSTIntegerValue integerValue:(int64_t)extended];
411+
return FieldValue::FromInteger(static_cast<int64_t>(extended)).Wrap();
412412
}
413413
}
414414

415415
case 'f':
416-
return [FSTDoubleValue doubleValue:[input doubleValue]];
416+
return FieldValue::FromDouble([input doubleValue]).Wrap();
417417

418418
case 'd':
419419
// Double values are already the right type, so just reuse the existing boxed double.
420420
//
421421
// Note that NSNumber already performs NaN normalization to a single shared instance
422422
// so there's no need to treat NaN specially here.
423-
return [FSTDoubleValue doubleValue:[input doubleValue]];
423+
return FieldValue::FromDouble([input doubleValue]).Wrap();
424424

425425
case 'B': // Falls through.
426426
case 'c': // Falls through.
@@ -453,7 +453,8 @@ - (nullable FSTFieldValue *)parseScalarValue:(nullable id)input context:(ParseCo
453453
return [FSTTimestampValue timestampValue:truncatedTimestamp];
454454

455455
} else if ([input isKindOfClass:[FIRGeoPoint class]]) {
456-
return [FSTGeoPointValue geoPointValue:input];
456+
FIRGeoPoint *geoPoint = input;
457+
return FieldValue::FromGeoPoint([geoPoint toGeoPoint]).Wrap();
457458

458459
} else if ([input isKindOfClass:[NSData class]]) {
459460
return [FSTBlobValue blobValue:input];

Firestore/Source/Core/FSTQuery.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ NS_ASSUME_NONNULL_BEGIN
3636
/**
3737
* Creates a filter for the provided path, operator, and value.
3838
*
39-
* Note that if the relational operator is Filter::Operator::Equal and
40-
* the value is [FSTNullValue nullValue] or [FSTDoubleValue nanValue], this
41-
* will return the appropriate FSTNullFilter or FSTNanFilter class instead of a
39+
* Note that if the relational operator is Filter::Operator::Equal and the
40+
* value is FieldValue::Null() or FieldValue::Nan(), this will return the
41+
* appropriate FSTNullFilter or FSTNanFilter class instead of a
4242
* FSTRelationFilter.
4343
*/
4444
+ (instancetype)filterWithField:(const model::FieldPath &)field

Firestore/Source/Core/FSTQuery.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ @implementation FSTFilter
7676
+ (instancetype)filterWithField:(const FieldPath &)field
7777
filterOperator:(Filter::Operator)op
7878
value:(FSTFieldValue *)value {
79-
if ([value isEqual:[FSTNullValue nullValue]]) {
79+
if (value.type == FieldValue::Type::Null) {
8080
if (op != Filter::Operator::Equal) {
8181
ThrowInvalidArgument("Invalid Query. Nil and NSNull only support equality comparisons.");
8282
}
8383
return [[FSTNullFilter alloc] initWithField:field];
84-
} else if ([value isEqual:[FSTDoubleValue nanValue]]) {
84+
} else if (value.isNAN) {
8585
if (op != Filter::Operator::Equal) {
8686
ThrowInvalidArgument("Invalid Query. NaN only supports equality comparisons.");
8787
}
@@ -268,7 +268,7 @@ - (instancetype)initWithField:(FieldPath)field {
268268

269269
- (BOOL)matchesDocument:(FSTDocument *)document {
270270
FSTFieldValue *fieldValue = [document fieldForPath:self.field];
271-
return fieldValue != nil && [fieldValue isEqual:[FSTNullValue nullValue]];
271+
return fieldValue != nil && fieldValue.type == FieldValue::Type::Null;
272272
}
273273

274274
- (NSString *)canonicalID {
@@ -314,7 +314,7 @@ - (instancetype)initWithField:(FieldPath)field {
314314

315315
- (BOOL)matchesDocument:(FSTDocument *)document {
316316
FSTFieldValue *fieldValue = [document fieldForPath:self.field];
317-
return fieldValue != nil && [fieldValue isEqual:[FSTDoubleValue nanValue]];
317+
return fieldValue != nil && fieldValue.isNAN;
318318
}
319319

320320
- (NSString *)canonicalID {

0 commit comments

Comments
 (0)