From 40f2b1bbb7dfc37ddd7109c208050e3486455ba9 Mon Sep 17 00:00:00 2001 From: rh389 Date: Tue, 10 Jan 2017 22:46:22 -0800 Subject: [PATCH] Prevent compiler inferring incorrect type Summary: Fixes the build warning: ```react-native/React/Modules/RCTRedBox.m:406:58: Conversion from value of type 'NSArray *' to incompatible type 'NSArray *``` This appears because the compiler is left to infer the type of `stack`, and it does so as `NSArray` based on [RCTRedBox.m#L390](https://github.com/facebook/react-native/blob/master/React/Modules/RCTRedBox.m#L390). In reality `stack` may be either of two types and the function body deals with normalisation. Mark the stack as explicitly `NSArray` to prevent inference so we're free to make the decision to cast to more specific types. Closes https://github.com/facebook/react-native/pull/11807 Differential Revision: D4402916 fbshipit-source-id: 356343f244af7638b9b9e91c2c5b7e68de0cbd33 --- React/Modules/RCTRedBox.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Modules/RCTRedBox.m b/React/Modules/RCTRedBox.m index 62c9a3c6a..c3e1c0f91 100644 --- a/React/Modules/RCTRedBox.m +++ b/React/Modules/RCTRedBox.m @@ -400,7 +400,7 @@ RCT_EXPORT_MODULE() [self showErrorMessage:message withStack:stack isUpdate:YES]; } -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack isUpdate:(BOOL)isUpdate +- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack isUpdate:(BOOL)isUpdate { if (![[stack firstObject] isKindOfClass:[RCTJSStackFrame class]]) { stack = [RCTJSStackFrame stackFramesWithDictionaries:stack];