diff options
Diffstat (limited to 'test/SemaObjC/error-missing-getter.m')
-rw-r--r-- | test/SemaObjC/error-missing-getter.m | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/test/SemaObjC/error-missing-getter.m b/test/SemaObjC/error-missing-getter.m index 3c91ab2..3dce858 100644 --- a/test/SemaObjC/error-missing-getter.m +++ b/test/SemaObjC/error-missing-getter.m @@ -9,11 +9,34 @@ @end int func (int arg, Subclass *x) { - if (x.setterOnly) { // expected-error {{expected getter method not found on object of type 'Subclass *'}} + if (x.setterOnly) { // expected-error {{no getter method for read from property}} x.setterOnly = 1; } - func(x.setterOnly + 1, x); // expected-error {{expected getter method not found on object of type 'Subclass *'}} - int i = x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}} - return x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}} + func(x.setterOnly + 1, x); // expected-error {{no getter method for read from property}} + int i = x.setterOnly + 1; // expected-error {{no getter method for read from property}} + return x.setterOnly + 1; // expected-error {{no getter method for read from property}} } +// <rdar://problem/12765391> + +@interface TestClass ++ (void) setSetterOnly : (int) arg; +@end + +int func2 (int arg) { + if (TestClass.setterOnly) { // expected-error {{no getter method for read from property}} + TestClass.setterOnly = 1; + } + func(TestClass.setterOnly + 1, x); // expected-error {{no getter method for read from property}} + int i = TestClass.setterOnly + 1; // expected-error {{no getter method for read from property}} + return TestClass.setterOnly + 1; // expected-error {{no getter method for read from property}} +} + +@interface Sub : Subclass +- (int) func3; +@end +@implementation Sub +- (int) func3 { + return super.setterOnly; // expected-error {{no getter method for read from property}} +} +@end |