Skip to content

Instantly share code, notes, and snippets.

@hborders
Created March 13, 2017 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hborders/03cdfad53ad8d812458d8886d2f02bc6 to your computer and use it in GitHub Desktop.
Save hborders/03cdfad53ad8d812458d8886d2f02bc6 to your computer and use it in GitHub Desktop.
Trying to unpack the wrong distinct values from a sum type
static void badPrintExample(Example * _Nonnull example) {
[example switchFoo:^(ExampleBar * _Nonnull bar_) {
// ^
// error: incompatible block pointer types sending 'void (^)(ExampleBar * _Nonnull __strong)' to parameter of type 'void (^ _Nonnull)(ExampleFoo * _Nonnull __strong)'
NSLog(@"Bar: %@, %@", @(bar_.b), @(bar_.c));
}
bar:^(ExampleFoo * _Nonnull foo_) {
// ^
// error: incompatible block pointer types sending 'void (^)(ExampleFoo * _Nonnull __strong)' to parameter of type 'void (^ _Nonnull)(ExampleBar * _Nonnull __strong)'
NSLog(@"Foo: %@, %@", foo_.f, foo_.g);
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment