mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 10:06:36 +00:00

If a class declares an instance property, and an inheritor class declares a class property with the same name, Clang Sema currently treats the latter as an overridden property, and compares the attributes of the two properties to check for a mismatch. The resulting diagnostics might be misleading, since neither of the properties actually overrides the another one. rdar://86018435 Differential Revision: https://reviews.llvm.org/D116412
40 lines
1.4 KiB
Objective-C
40 lines
1.4 KiB
Objective-C
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
@class MyObject;
|
|
|
|
|
|
@interface TopClassWithClassProperty0
|
|
@property(nullable, readonly, strong, class) MyObject *foo;
|
|
@end
|
|
|
|
@interface SubClassWithClassProperty0 : TopClassWithClassProperty0
|
|
@property(nonnull, readonly, copy, class) MyObject *foo; // expected-warning {{'copy' attribute on property 'foo' does not match the property inherited from 'TopClassWithClassProperty0'}}
|
|
@end
|
|
|
|
|
|
|
|
@interface TopClassWithInstanceProperty1
|
|
@property(nullable, readonly, strong) MyObject *foo;
|
|
@end
|
|
|
|
@interface ClassWithClassProperty1 : TopClassWithInstanceProperty1
|
|
@property(nonnull, readonly, copy, class) MyObject *foo; // no-warning
|
|
@end
|
|
|
|
@interface SubClassWithInstanceProperty1 : ClassWithClassProperty1
|
|
@property(nullable, readonly, copy) MyObject *foo; // expected-warning {{'copy' attribute on property 'foo' does not match the property inherited from 'TopClassWithInstanceProperty1'}}
|
|
@end
|
|
|
|
|
|
@interface TopClassWithClassProperty2
|
|
@property(nullable, readonly, strong, class) MyObject *foo;
|
|
@end
|
|
|
|
@interface ClassWithInstanceProperty2 : TopClassWithClassProperty2
|
|
@property(nonnull, readonly, copy) MyObject *foo; // no-warning
|
|
@end
|
|
|
|
@interface SubClassWithClassProperty2 : ClassWithInstanceProperty2
|
|
@property(nonnull, readonly, copy, class) MyObject *foo; // expected-warning {{'copy' attribute on property 'foo' does not match the property inherited from 'TopClassWithClassProperty2'}}
|
|
@end
|