forked from OSchip/llvm-project
objective-c: When redeclaraing in continuation class a 'readonly'
property to 'readwrite', also allow redeclaration of property type to a narrowring object type. // rdar://10790488 llvm-svn: 149614
This commit is contained in:
parent
510340fdc2
commit
6a73384b53
|
@ -276,12 +276,19 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
||||||
L->AddedObjCPropertyInClassExtension(PDecl, /*OrigProp=*/0, CDecl);
|
L->AddedObjCPropertyInClassExtension(PDecl, /*OrigProp=*/0, CDecl);
|
||||||
return PDecl;
|
return PDecl;
|
||||||
}
|
}
|
||||||
if (PIDecl->getType().getCanonicalType()
|
if (!Context.hasSameType(PIDecl->getType(), PDecl->getType())) {
|
||||||
!= PDecl->getType().getCanonicalType()) {
|
bool IncompatibleObjC = false;
|
||||||
|
QualType ConvertedType;
|
||||||
|
if (!isa<ObjCObjectPointerType>(PIDecl->getType()) ||
|
||||||
|
!isa<ObjCObjectPointerType>(PDecl->getType()) ||
|
||||||
|
(!isObjCPointerConversion(PDecl->getType(), PIDecl->getType(),
|
||||||
|
ConvertedType, IncompatibleObjC))
|
||||||
|
|| IncompatibleObjC) {
|
||||||
Diag(AtLoc,
|
Diag(AtLoc,
|
||||||
diag::err_type_mismatch_continuation_class) << PDecl->getType();
|
diag::err_type_mismatch_continuation_class) << PDecl->getType();
|
||||||
Diag(PIDecl->getLocation(), diag::note_property_declare);
|
Diag(PIDecl->getLocation(), diag::note_property_declare);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The property 'PIDecl's readonly attribute will be over-ridden
|
// The property 'PIDecl's readonly attribute will be over-ridden
|
||||||
// with continuation class's readwrite property attribute!
|
// with continuation class's readwrite property attribute!
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
// RUN: %clang_cc1 -x objective-c -fsyntax-only -verify %s
|
||||||
|
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
|
||||||
|
// rdar://10790488
|
||||||
|
|
||||||
|
@interface NSArray @end
|
||||||
|
|
||||||
|
@interface NSMutableArray : NSArray
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface GKTurnBasedMatchMakerKVO
|
||||||
|
@property(nonatomic,readonly,retain) NSArray* outline;
|
||||||
|
@property(nonatomic,readonly,retain) NSMutableArray* err_outline; // expected-note {{property declared here}}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface GKTurnBasedMatchMakerKVO ()
|
||||||
|
@property(nonatomic,readwrite,retain) NSMutableArray* outline;
|
||||||
|
@property(nonatomic,readwrite,retain) NSArray* err_outline; // expected-error {{type of property 'NSArray *' in continuation class does not match property type in primary class}}
|
||||||
|
@end
|
||||||
|
|
Loading…
Reference in New Issue