Created
March 3, 2013 23:44
-
-
Save pwc3/5078925 to your computer and use it in GitHub Desktop.
Type checking assignments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary *aDictionary = nil; | |
NSArray *anArray = nil; | |
void (^aBlock)() = ^{ }; | |
// no warning | |
aDictionary = aBlock; | |
// no warning | |
anArray = aBlock; | |
// warning assigning NSArray to NSDictionary, but not for block assignment | |
aDictionary = anArray = aBlock; | |
// Similarly: | |
id anUntypedObject = nil; | |
// no warning | |
aDictionary = anUntypedObject; | |
// no warning | |
anArray = anUntypedObject; | |
// warning assigning NSArray to NSDictionary, but not for block assignment | |
aDictionary = anArray = anUntypedObject; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment