Skip to content

Instantly share code, notes, and snippets.

@hborders hborders/MissingReturn.m
Last active May 14, 2018

What would you like to do?
An example of the compiler error when get when we miss a return that a block requires
#import "Example.h" //
- (void)missingReturn {
Example * _Nonnull fooExample = [[ExampleFoo alloc] initWithF:@"foo"
NSNumber * _Nonnull number =
[ExampleSwitcher<NSNumber *> nonnullExampleFrom:fooExample
switchFoo:^(ExampleFoo * _Nonnull foo_) {
return @(foo_.f.length + foo_.g.length);
bar:^(ExampleBar * _Nonnull bar_) {
// should be:
// return @(bar_.b.length + bar.c.length);
@(bar_.b.length + bar.c.length);
// error: control reaches end of non-void block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.