Skip to content

Commit 49d5f4c

Browse files
committed
Force a downcast of AnyObject to NSObject to avoid implicit type conversion cases
1 parent f24b4d9 commit 49d5f4c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Foundation/NSDictionary.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,12 @@ public class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCodin
283283
}
284284

285285
for key in keyEnumerator() {
286-
if otherDictionary[key] == nil {
287-
return false
288-
} else if otherDictionary[key] != objectForKey(key) {
286+
if let otherValue = otherDictionary[key as! NSObject] as? NSObject {
287+
let value = objectForKey(key as! NSObject)! as! NSObject
288+
if otherValue != value {
289+
return false
290+
}
291+
} else {
289292
return false
290293
}
291294
}

0 commit comments

Comments
 (0)