brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 7edd2d8 Raw
114 lines · plain
1// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify -Wno-objc-root-class %s2// RUN: %clang_cc1 -x objective-c++ -Wmethod-signatures -fsyntax-only -verify -Wno-objc-root-class %s3 4@interface A @end5@interface B : A @end6 7@interface Test1 {}8- (void) test1:(A*) object; // expected-note {{previous definition is here}} 9- (void) test2:(B*) object;10@end11 12@implementation Test113- (void) test1:(B*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'A *' vs 'B *'}}14- (void) test2:(A*) object {}15@end16 17@interface Test2 {}18- (void) test1:(id) object; // expected-note {{previous definition is here}} 19- (void) test2:(A*) object;20@end21 22@implementation Test223- (void) test1:(A*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'id' vs 'A *'}}24- (void) test2:(id) object {}25@end26 27@interface Test3 {}28- (A*) test1;29- (B*) test2; // expected-note {{previous definition is here}} 30@end31 32@implementation Test333- (B*) test1 { return 0; }34- (A*) test2 { return 0; } // expected-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}35@end36 37// The particular case of overriding with an id return is permitted.38@interface Test4 {}39- (id) test1;40- (A*) test2;41@end42@implementation Test443- (A*) test1 { return 0; }44- (id) test2 { return 0; }45@end46 47typedef int int32_t;48typedef long long int64_t;49 50@interface NSObject @end51 52@protocol CKMessage53@property (nonatomic,readonly,assign) int64_t sequenceNumber; // expected-note {{previous definition is here}}54@end55 56@protocol CKMessage;57 58@interface CKIMMessage : NSObject<CKMessage>59@end60 61@implementation CKIMMessage62- (int32_t)sequenceNumber { // expected-warning {{conflicting return type in implementation of 'sequenceNumber': 'int64_t' (aka 'long long') vs 'int32_t' (aka 'int')}}63  return 0;64}65@end66 67// Tests that property inherited indirectly from a nested protocol68// is seen by the method implementation type matching logic before69// method in super class is seen. This fixes the warning coming70// out of that method mismatch.71@interface NSObject (NSDict)72- (void)setValue:(id)value;73- (id)value;74@end75 76@protocol ProtocolWithValue77@property (nonatomic) unsigned value;78@end79 80@protocol InterveningProtocol <ProtocolWithValue>81@end82 83@interface UsesProtocolWithValue : NSObject <ProtocolWithValue>84@end85 86@implementation UsesProtocolWithValue87@synthesize value=_value;88- (unsigned) value89{90	return _value;91}92- (void) setValue:(unsigned)value93{94	_value = value;95}96@end97 98 99@interface UsesInterveningProtocol : NSObject <InterveningProtocol>100@end101 102@implementation UsesInterveningProtocol103 104@synthesize value=_value;105- (unsigned) value106{107	return _value;108}109- (void) setValue:(unsigned)value110{111	_value = value;112}113@end114