diff options
Diffstat (limited to 'test/SemaObjC/warn-strict-selector-match.m')
-rw-r--r-- | test/SemaObjC/warn-strict-selector-match.m | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/test/SemaObjC/warn-strict-selector-match.m b/test/SemaObjC/warn-strict-selector-match.m index 9f22e73..13e9bac 100644 --- a/test/SemaObjC/warn-strict-selector-match.m +++ b/test/SemaObjC/warn-strict-selector-match.m @@ -13,23 +13,24 @@ int main() { [(id)0 method]; } // expected-warning {{multiple methods named 'met @interface Object @end @interface Class1 -- (void)setWindow:(Object *)wdw; // expected-note {{using}} +- (void)setWindow:(Object *)wdw; // expected-note 2 {{using}} @end @interface Class2 -- (void)setWindow:(Class1 *)window; // expected-note {{also found}} +- (void)setWindow:(Class1 *)window; // expected-note 2 {{also found}} @end id foo(void) { Object *obj = 0; id obj2 = obj; - [obj setWindow:0]; // expected-warning {{Object' may not respond to 'setWindow:'}} + [obj setWindow:0]; // expected-warning {{Object' may not respond to 'setWindow:'}} \ + // expected-warning {{multiple methods named 'setWindow:' found}} [obj2 setWindow:0]; // expected-warning {{multiple methods named 'setWindow:' found}} return obj; } @protocol MyObject -- (id)initWithData:(Object *)data; // expected-note {{using}} +- (id)initWithData:(Object *)data; // expected-note {{also found}} @end @protocol SomeOther @@ -37,7 +38,7 @@ id foo(void) { @end @protocol MyCoding -- (id)initWithData:(id<MyObject, MyCoding>)data; // expected-note {{also found}} +- (id)initWithData:(id<MyObject, MyCoding>)data; // expected-note {{using}} @end @interface NTGridDataObject: Object <MyCoding> @@ -71,3 +72,29 @@ void foo1(void) { [(Class)0 port]; // OK - gcc issues warning but there is only one Class method so no ambiguity to warn } +// rdar://19265430 +@interface NSObject +- (id)class; +- (id) alloc; +@end + +@class NSString; + +@interface A : NSObject +- (instancetype)initWithType:(NSString *)whatever; // expected-note {{also found}} +@end + +@interface Test : NSObject +@end + +@implementation Test ++ (instancetype)foo +{ + return [[[self class] alloc] initWithType:3]; // expected-warning {{multiple methods named 'initWithType:'}} +} + +- (instancetype)initWithType:(unsigned int)whatever // expected-note {{using}} +{ + return 0; +} +@end |