1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuctypedef struct { int y; } Abstract; 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambuctypedef struct { int x; } Alternate; 6f4a2713aSLionel Sambuc 7f4a2713aSLionel Sambuc#define INTERFERE_TYPE Alternate* 8f4a2713aSLionel Sambuc 9f4a2713aSLionel Sambuc@protocol A 10f4a2713aSLionel Sambuc@property Abstract *x; // expected-note {{using}} 11f4a2713aSLionel Sambuc@end 12f4a2713aSLionel Sambuc 13f4a2713aSLionel Sambuc@interface B 14f4a2713aSLionel Sambuc@property Abstract *y; // expected-note {{using}} 15f4a2713aSLionel Sambuc@end 16f4a2713aSLionel Sambuc 17f4a2713aSLionel Sambuc@interface B (Category) 18f4a2713aSLionel Sambuc@property Abstract *z; // expected-note {{using}} 19f4a2713aSLionel Sambuc@end 20f4a2713aSLionel Sambuc 21f4a2713aSLionel Sambuc@interface InterferencePre 22f4a2713aSLionel Sambuc-(void) x; // expected-note {{also found}} 23f4a2713aSLionel Sambuc-(void) y; // expected-note {{also found}} 24f4a2713aSLionel Sambuc-(void) z; // expected-note {{also found}} 25f4a2713aSLionel Sambuc-(void) setX: (INTERFERE_TYPE) arg; 26f4a2713aSLionel Sambuc-(void) setY: (INTERFERE_TYPE) arg; 27f4a2713aSLionel Sambuc-(void) setZ: (INTERFERE_TYPE) arg; 28f4a2713aSLionel Sambuc@end 29f4a2713aSLionel Sambuc 30f4a2713aSLionel Sambucvoid f0(id a0) { 31f4a2713aSLionel Sambuc Abstract *l = [a0 x]; // expected-warning {{multiple methods named 'x' found}} 32f4a2713aSLionel Sambuc} 33f4a2713aSLionel Sambuc 34f4a2713aSLionel Sambucvoid f1(id a0) { 35f4a2713aSLionel Sambuc Abstract *l = [a0 y]; // expected-warning {{multiple methods named 'y' found}} 36f4a2713aSLionel Sambuc} 37f4a2713aSLionel Sambuc 38f4a2713aSLionel Sambucvoid f2(id a0) { 39f4a2713aSLionel Sambuc Abstract *l = [a0 z]; // expected-warning {{multiple methods named 'z' found}} 40f4a2713aSLionel Sambuc} 41f4a2713aSLionel Sambuc 42f4a2713aSLionel Sambucvoid f3(id a0, Abstract *a1) { 43f4a2713aSLionel Sambuc [ a0 setX: a1]; 44f4a2713aSLionel Sambuc} 45f4a2713aSLionel Sambuc 46f4a2713aSLionel Sambucvoid f4(id a0, Abstract *a1) { 47f4a2713aSLionel Sambuc [ a0 setY: a1]; 48f4a2713aSLionel Sambuc} 49f4a2713aSLionel Sambuc 50f4a2713aSLionel Sambucvoid f5(id a0, Abstract *a1) { 51f4a2713aSLionel Sambuc [ a0 setZ: a1]; 52f4a2713aSLionel Sambuc} 53f4a2713aSLionel Sambuc 54f4a2713aSLionel Sambuc// pr7861 55f4a2713aSLionel Sambucvoid f6(id<A> a0) { 56f4a2713aSLionel Sambuc Abstract *l = [a0 x]; 57f4a2713aSLionel Sambuc} 58f4a2713aSLionel Sambuc 59f4a2713aSLionel Sambucstruct test3a { int x, y; }; 60f4a2713aSLionel Sambucstruct test3b { unsigned x, y; }; 61f4a2713aSLionel Sambuc@interface Test3A - (struct test3a) test3; @end 62f4a2713aSLionel Sambuc@interface Test3B - (struct test3b) test3; @end 63f4a2713aSLionel Sambucvoid test3(id x) { 64f4a2713aSLionel Sambuc (void) [x test3]; 65f4a2713aSLionel Sambuc} 66f4a2713aSLionel Sambuc 67f4a2713aSLionel Sambucstruct test4a { int x, y; }; 68f4a2713aSLionel Sambucstruct test4b { float x, y; }; 69f4a2713aSLionel Sambuc@interface Test4A - (struct test4a) test4; @end //expected-note{{using}} 70f4a2713aSLionel Sambuc@interface Test4B - (struct test4b) test4; @end //expected-note{{also found}} 71f4a2713aSLionel Sambucvoid test4(id x) { 72f4a2713aSLionel Sambuc (void) [x test4]; //expected-warning {{multiple methods named 'test4' found}} 73f4a2713aSLionel Sambuc} 74*0a6a1f1dSLionel Sambuc 75*0a6a1f1dSLionel Sambuc// rdar://19265296 76*0a6a1f1dSLionel Sambuc#pragma clang diagnostic ignored "-Wobjc-multiple-method-names" 77*0a6a1f1dSLionel Sambuc@interface NSObject 78*0a6a1f1dSLionel Sambuc+ (id)alloc; 79*0a6a1f1dSLionel Sambuc+ (id)class; 80*0a6a1f1dSLionel Sambuc- (id) init; 81*0a6a1f1dSLionel Sambuc@end 82*0a6a1f1dSLionel Sambuc 83*0a6a1f1dSLionel Sambuc@class NSString; 84*0a6a1f1dSLionel Sambuc@interface A : NSObject 85*0a6a1f1dSLionel Sambuc- (instancetype)initWithType:(NSString *)whatever; 86*0a6a1f1dSLionel Sambuc@end 87*0a6a1f1dSLionel Sambuc 88*0a6a1f1dSLionel Sambuc@interface Test : NSObject @end 89*0a6a1f1dSLionel Sambuc 90*0a6a1f1dSLionel Sambuc@implementation Test 91*0a6a1f1dSLionel Sambuc+ (instancetype)foo 92*0a6a1f1dSLionel Sambuc{ 93*0a6a1f1dSLionel Sambuc return [[[self class] alloc] initWithType:3]; 94*0a6a1f1dSLionel Sambuc} 95*0a6a1f1dSLionel Sambuc- (instancetype)initWithType:(int)whatever 96*0a6a1f1dSLionel Sambuc{ 97*0a6a1f1dSLionel Sambuc return [super init]; 98*0a6a1f1dSLionel Sambuc} 99*0a6a1f1dSLionel Sambuc@end 100