Fix use of SEL in AL

Reviewed By: jberdine

Differential Revision: D5847272

fbshipit-source-id: 08591aa
master
Dino Distefano 7 years ago committed by Facebook Github Bot
parent 4ec5440692
commit f3b158a158

@ -402,6 +402,8 @@ let rec pointer_type_equal p ap =
match (p, ap) with
| PointerType (_, qt), Pointer abs_ctype' | ObjCObjectPointerType (_, qt), Pointer abs_ctype'
-> check_type_ptr qt.qt_type_ptr abs_ctype'
| PointerType (_, qt), BuiltIn _
-> check_type_ptr qt.qt_type_ptr ap
| _, _
-> display_equality_warning () ; false
@ -451,7 +453,9 @@ and c_type_equal c_type abs_ctype =
match (c_type, abs_ctype) with
| BuiltinType (_, bi), BuiltIn abi
-> builtin_equal bi abi
| PointerType _, Pointer _ | ObjCObjectPointerType _, Pointer _
| TypedefType (_, tdi), BuiltIn _
-> check_type_ptr tdi.tti_child_type.qt_type_ptr abs_ctype
| PointerType _, BuiltIn _ | PointerType _, Pointer _ | ObjCObjectPointerType _, Pointer _
-> pointer_type_equal c_type abs_ctype
| LValueReferenceType (_, qt), Reference abs_typ | RValueReferenceType (_, qt), Reference abs_typ
-> check_type_ptr qt.qt_type_ptr abs_typ

@ -39,6 +39,8 @@ codetoanalyze/objc/linters-for-test-only/protocols.m, Foo_newWithD, 28, TEST_BUI
codetoanalyze/objc/linters-for-test-only/protocols.m, Linters_dummy_method, 11, TEST_PROTOCOL_DEF_INHERITANCE, []
codetoanalyze/objc/linters-for-test-only/protocols.m, Linters_dummy_method, 14, TEST_PROTOCOL_DEF_INHERITANCE, []
codetoanalyze/objc/linters-for-test-only/protocols.m, Linters_dummy_method, 17, TEST_PROTOCOL_DEF_INHERITANCE, []
codetoanalyze/objc/linters-for-test-only/sel.m, fooButtonComponent_newWithAction, 12, TEST_INSTANCE_TYPE, []
codetoanalyze/objc/linters-for-test-only/sel.m, fooButtonComponent_newWithAction, 12, TEST_PARAMETER_SEL_TYPE, []
codetoanalyze/objc/linters-for-test-only/subclassing.m, A_foo, 13, TEST_BUILTIN_TYPE, []
codetoanalyze/objc/linters-for-test-only/subclassing.m, A_foo, 13, TEST_PARAM_TYPE_CHECK2, []
codetoanalyze/objc/linters-for-test-only/subclassing.m, A_foo, 13, TEST_RETURN_METHOD, []

@ -402,3 +402,15 @@ DEFINE-CHECKER ENUM_CONSTANTS_OF_ENUM = {
HOLDS-IN-NODE VarDecl;
SET message = "var %name% declared in function";
};
DEFINE-CHECKER TEST_PARAMETER_SEL_TYPE = {
SET report_when =
WHEN
method_return_type("instancetype") AND
method_has_a_parameter_with_type("SEL")
HOLDS-IN-NODE ObjCMethodDecl;
SET message = "Method has parameter of type SEL";
};

@ -0,0 +1,13 @@
/*
* Copyright (c) 2017 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include <Foundation/NSObject.h>
@interface fooButtonComponent : NSObject
+ (instancetype)newWithAction:(SEL)selector;
@end
Loading…
Cancel
Save