Browse files

Prevent compiler inferring incorrect type

Fixes the build warning:

```react-native/React/Modules/RCTRedBox.m:406:58: Conversion from value of type 'NSArray<RCTJSStackFrame *> *' to incompatible type 'NSArray<NSDictionary *> *```

This appears because the compiler is left to infer the type of `stack`, and it does so as `NSArray<RCTJSStackFrame *>` based on [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<id>` to prevent inference so we're free to make the decision to cast to more specific types.
Closes #11807

Differential Revision: D4402916

fbshipit-source-id: 356343f244af7638b9b9e91c2c5b7e68de0cbd33
  • Loading branch information...
rh389 authored and facebook-github-bot committed Jan 11, 2017
1 parent b27c541 commit 40f2b1bbb7dfc37ddd7109c208050e3486455ba9
Showing with 1 addition and 1 deletion.
  1. +1 −1 React/Modules/RCTRedBox.m
@@ -400,7 +400,7 @@ - (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack
[self showErrorMessage:message withStack:stack isUpdate:YES];
-- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack isUpdate:(BOOL)isUpdate
+- (void)showErrorMessage:(NSString *)message withStack:(NSArray<id> *)stack isUpdate:(BOOL)isUpdate
if (![[stack firstObject] isKindOfClass:[RCTJSStackFrame class]]) {
stack = [RCTJSStackFrame stackFramesWithDictionaries:stack];

0 comments on commit 40f2b1b

Please sign in to comment.