Created
March 13, 2017 18:05
-
-
Save hborders/5c49e5f542245c67af096ae0ced37037 to your computer and use it in GitHub Desktop.
Only assigning to a __block variable in one of the blocks. I wish this was an error.
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
#import "Example.h" // https://gist.github.com/hborders/2af9b39e27b62ef9e68c65085126fe4a | |
- (void)missingAssignment { | |
Example * _Nonnull fooExample = [[ExampleFoo alloc] initWithF:@"foo" | |
g:@"goo"]; | |
NSNumber * _Nonnull __block number; | |
[fooExample switchFoo:^(ExampleFoo * _Nonnull foo_) { | |
number = @(foo_.f.length + foo_.g.length); | |
} | |
bar:^(ExampleBar * _Nonnull bar_) { | |
// should be: | |
// number = @(bar_.b.length + bar.c.length); | |
@(bar_.b.length + bar.c.length); | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment