xref: /llvm-project/clang/test/SemaObjC/class-property-inheritance.m (revision fda47db8ee1d3eca8c42819cf1b65ab0ef7df7b8)
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3@class MyObject;
4
5
6@interface TopClassWithClassProperty0
7@property(nullable, readonly, strong, class) MyObject *foo;
8@end
9
10@interface SubClassWithClassProperty0 : TopClassWithClassProperty0
11@property(nonnull, readonly, copy, class) MyObject *foo; // expected-warning {{'copy' attribute on property 'foo' does not match the property inherited from 'TopClassWithClassProperty0'}}
12@end
13
14
15
16@interface TopClassWithInstanceProperty1
17@property(nullable, readonly, strong) MyObject *foo;
18@end
19
20@interface ClassWithClassProperty1 : TopClassWithInstanceProperty1
21@property(nonnull, readonly, copy, class) MyObject *foo; // no-warning
22@end
23
24@interface SubClassWithInstanceProperty1 : ClassWithClassProperty1
25@property(nullable, readonly, copy) MyObject *foo; // expected-warning {{'copy' attribute on property 'foo' does not match the property inherited from 'TopClassWithInstanceProperty1'}}
26@end
27
28
29@interface TopClassWithClassProperty2
30@property(nullable, readonly, strong, class) MyObject *foo;
31@end
32
33@interface ClassWithInstanceProperty2 : TopClassWithClassProperty2
34@property(nonnull, readonly, copy) MyObject *foo; // no-warning
35@end
36
37@interface SubClassWithClassProperty2 : ClassWithInstanceProperty2
38@property(nonnull, readonly, copy, class) MyObject *foo; // expected-warning {{'copy' attribute on property 'foo' does not match the property inherited from 'TopClassWithClassProperty2'}}
39@end
40