xref: /aosp_15_r20/external/clang/test/SemaObjC/compare-qualified-id.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li
3*67e74705SXin Litypedef signed char BOOL;
4*67e74705SXin Litypedef unsigned int NSUInteger;
5*67e74705SXin Litypedef struct _NSZone NSZone;
6*67e74705SXin Li@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
7*67e74705SXin Li@protocol NSObject  - (BOOL)isEqual:(id)object; @end
8*67e74705SXin Li@protocol NSCopying  - (id)copyWithZone:(NSZone *)zone; @end // expected-note {{method 'copyWithZone:' declared here}}
9*67e74705SXin Li@protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone; @end
10*67e74705SXin Li@protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder; @end
11*67e74705SXin Li@interface NSObject <NSObject> {} @end
12*67e74705SXin Litypedef struct {} NSFastEnumerationState;
13*67e74705SXin Li@protocol NSFastEnumeration  - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; @end
14*67e74705SXin Li@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>  - (NSUInteger)count; @end
15*67e74705SXin Li@interface NSMutableDictionary : NSDictionary  - (void)removeObjectForKey:(id)aKey; @end // expected-note {{receiver is instance of class declared here}}
16*67e74705SXin Liextern NSString * const NSTaskDidTerminateNotification;
17*67e74705SXin Li
18*67e74705SXin Li@interface XCPropertyExpansionContext : NSObject <NSCopying> {
19*67e74705SXin Li  NSMutableDictionary * _propNamesToPropValuesCache;
20*67e74705SXin Li} @end
21*67e74705SXin Li
22*67e74705SXin Li@protocol XCPropertyValues <NSObject, NSCopying>
23*67e74705SXin Li- (NSString *)evaluateAsStringInContext:(XCPropertyExpansionContext *)context withNestingState:(const void *)state;
24*67e74705SXin Li@end
25*67e74705SXin Li
26*67e74705SXin Li@implementation XCPropertyExpansionContext // expected-warning {{method 'copyWithZone:' in protocol 'NSCopying' not implemented}}
27*67e74705SXin Li- (NSString *)expandedValueForProperty:(NSString *)property {
28*67e74705SXin Li  id <XCPropertyValues> cachedValueNode = [_propNamesToPropValuesCache objectForKey:property]; // expected-warning {{method '-objectForKey:' not found (return type defaults to 'id')}}
29*67e74705SXin Li  if (cachedValueNode == ((void *)0)) { }
30*67e74705SXin Li  NSString * expandedValue = [cachedValueNode evaluateAsStringInContext:self withNestingState:((void *)0)];
31*67e74705SXin Li  return expandedValue;
32*67e74705SXin Li}
33*67e74705SXin Li@end
34