def err_invalid_property_name : Error<
"%0 is not a valid property name (accessing an object of type %1)">;
def err_getter_not_found : Error<
- "expected getter method not found on object of type %0">;
+ "no getter method for read from property">;
def err_objc_subscript_method_not_found : Error<
"expected method to %select{read|write}1 %select{dictionary|array}2 element not "
"found on object of type %0">;
Expr *rebuildSpecific(ObjCPropertyRefExpr *refExpr) {
// Fortunately, the constraint that we're rebuilding something
// with a base limits the number of cases here.
- assert(refExpr->getBase());
+ assert(refExpr->isObjectReceiver());
if (refExpr->isExplicitProperty()) {
return new (S.Context)
ExprResult ObjCPropertyOpBuilder::buildRValueOperation(Expr *op) {
// Explicit properties always have getters, but implicit ones don't.
// Check that before proceeding.
- if (RefExpr->isImplicitProperty() &&
- !RefExpr->getImplicitPropertyGetter()) {
+ if (RefExpr->isImplicitProperty() && !RefExpr->getImplicitPropertyGetter()) {
S.Diag(RefExpr->getLocation(), diag::err_getter_not_found)
- << RefExpr->getBase()->getType();
+ << RefExpr->getSourceRange();
return ExprError();
}
@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
void f(C *c) {
c.Foo = 17; // OK
- g(c.Foo); // expected-error {{expected getter method not found on object of type 'C *'}}
+ g(c.Foo); // expected-error {{no getter method for read from property}}
}
self.Pxyz = 0; // expected-error {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
self.pxyz = 0; // expected-error {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
self.R = 0;
- return self.R; // expected-error {{expected getter method not found on object of type 'rdar11363363 *'}}
+ return self.R; // expected-error {{no getter method for read from property}}
}
@end
- (int) z;
@end
void test2(Test2 *a) {
- auto y = a.y; // expected-error {{expected getter method not found on object of type 'Test2 *'}}
+ auto y = a.y; // expected-error {{no getter method for read from property}}
auto z = a.z;
}