llvm-project/clang/test/SemaObjC/dynamic-direct-properties.m
Pierre Habouzit 3adcc78a80 [objc_direct] Small updates to help with adoption.
Add fixits for messaging self in MRR or using super, as the intent is
clear, and it turns out people do that a lot more than expected.

Allow for objc_direct_members on main interfaces, it's extremely useful
for internal only classes, and proves to be quite annoying for adoption.

Add some better warnings around properties direct/non-direct clashes (it
was done for methods but properties were a miss).

Add some errors when direct properties are marked @dynamic.

Radar-Id: rdar://problem/58355212
Signed-off-by: Pierre Habouzit <phabouzit@apple.com>
Differential Revision: https://reviews.llvm.org/D73755
2020-02-16 16:32:41 -08:00

23 lines
710 B
Objective-C

// RUN: %clang_cc1 -fsyntax-only -verify -Wselector-type-mismatch %s
__attribute__((objc_root_class))
@interface Foo
@property() int dynamic_property;
@property(direct) int direct_property; // expected-note {{previous declaration is here}}
@end
@implementation Foo
@dynamic dynamic_property;
@dynamic direct_property; // expected-error {{direct property cannot be @dynamic}}
@end
@interface Foo (Bar)
@property() int dynamic_category_property;
@property(direct) int direct_category_property; // expected-note {{previous declaration is here}}
@end
@implementation Foo (Bar)
@dynamic dynamic_category_property;
@dynamic direct_category_property; // expected-error {{direct property cannot be @dynamic}}
@end