[infer][PR] handle improper version strings in @available clauses

Summary: Closes https://github.com/facebook/infer/pull/947

Reviewed By: dulmarod

Differential Revision: D8531636

Pulled By: martintrojer

fbshipit-source-id: 997d29c
master
Martin Trojer 7 years ago committed by Facebook Github Bot
parent 055a8267e8
commit 5156ff7f65

@ -292,7 +292,7 @@ let suppress_stderr2 f2 x1 x2 =
let compare_versions v1 v2 =
let int_list_of_version v =
let lv = String.split ~on:'.' v in
let lv = match String.split ~on:'.' v with [v] -> [v; "0"] | v -> v in
let int_of_string_or_zero v = try int_of_string v with Failure _ -> 0 in
List.map ~f:int_of_string_or_zero lv
in

@ -1,9 +1,9 @@
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_m2, 134, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_m3, 142, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_uifont_without_respondstoselector, 116, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_with_responds_to_selector_in_else, 69, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_instances_responds_to_selector, 93, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_responds_to_selector, 62, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_m2, 137, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_m3, 145, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_uifont_without_respondstoselector, 119, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_with_responds_to_selector_in_else, 72, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_instances_responds_to_selector, 96, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_responds_to_selector, 65, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_in_supported_ios_sdk.m, OpenURLOptionsFromSourceApplication, 75, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_in_supported_ios_sdk.m, Unavailable_api_in_supported_ios_sdk_test, 27, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []
codetoanalyze/objc/ioslints/unavailable_api_in_supported_ios_sdk.m, Unavailable_api_in_supported_ios_sdk_unsupported_class, 41, UNAVAILABLE_CLASS_IN_SUPPORTED_IOS_SDK, no_bucket, ERROR, []

@ -4,8 +4,11 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <AVFoundation/AVPlayer.h>
#import <Foundation/NSDictionary.h>
#import <Photos/PHAssetResource.h>
#import <UIKit/UIImagePickerController.h>
#import <UIKit/UIKit.h>
@interface Unavailable_api_allowed_cases : NSObject
@ -206,4 +209,14 @@
}
}
// no bug
- (PHAsset*)improper_ios_version_good:(NSDictionary*)info {
PHAsset* videoAsset = NULL;
if (@available(iOS 11, *)) { // not strictly correct version number, should be
// "11.0" We should handle this case anyway.
videoAsset = [info objectForKey:UIImagePickerControllerPHAsset];
}
return videoAsset;
}
@end

Loading…
Cancel
Save