Skip to content

Commit

Permalink
Fix for CBLModel getters of type 'id' (or Swift 'String')
Browse files Browse the repository at this point in the history
For some reason the prior fix was only implemented for setter methods,
not getters, and the unit tests didn't notice because they only tested
the untyped setter...
Fixes #648
  • Loading branch information
snej committed May 5, 2015
1 parent feb7ff5 commit eb4ff92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/API/CBLModel+Properties.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ + (BOOL) hasRelation: (NSString*)relation {
+ (IMP) impForGetterOfProperty: (NSString*)property ofClass: (Class)propertyClass {
id (^impBlock)(CBLModel*) = nil;

if (propertyClass == Nil) {
if (propertyClass == Nil || propertyClass == [NSObject class]) {
// Untyped
return [super impForGetterOfProperty: property ofClass: propertyClass];
} else if (propertyClass == [NSString class]
Expand Down
1 change: 1 addition & 0 deletions Unit-Tests/Model_Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ - (void) test00_SaveModel {
AssertEqual(model.url, url);
AssertEq(model.other, model3);
AssertEqual(model.others, (@[model2, model3]));
AssertEqual(model.untypedObject, @"this is an id");

// Save it and make sure the save didn't trigger a reload:
AssertEqual(db.unsavedModels, @[model]);
Expand Down

0 comments on commit eb4ff92

Please sign in to comment.