From: Fariborz Jahanian Date: Wed, 8 Apr 2015 21:34:04 +0000 (+0000) Subject: [Objective-C Sema] Use canonical type of properties when comparing X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b8ee3f469a9d7ceb1b3fed2f3dbd876fe463bd2;p=clang [Objective-C Sema] Use canonical type of properties when comparing redeclaration of property in class extension and to avoid bogus error. rdar://20469452 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234440 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index f4f43360f5..5e7b4b8b85 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -407,9 +407,11 @@ Sema::HandlePropertyInClassExtension(Scope *S, // this conversion is safe only because the wider type is for a 'readonly' // property in primary class and 'narrowed' type for a 'readwrite' property // in continuation class. - if (!isa(PIDecl->getType()) || - !isa(PDecl->getType()) || - (!isObjCPointerConversion(PDecl->getType(), PIDecl->getType(), + QualType PrimaryClassPropertyT = Context.getCanonicalType(PIDecl->getType()); + QualType ClassExtPropertyT = Context.getCanonicalType(PDecl->getType()); + if (!isa(PrimaryClassPropertyT) || + !isa(ClassExtPropertyT) || + (!isObjCPointerConversion(ClassExtPropertyT, PrimaryClassPropertyT, ConvertedType, IncompatibleObjC)) || IncompatibleObjC) { Diag(AtLoc, diff --git a/test/SemaObjC/property-9.m b/test/SemaObjC/property-9.m index 4bed8751b6..623143d549 100644 --- a/test/SemaObjC/property-9.m +++ b/test/SemaObjC/property-9.m @@ -106,3 +106,18 @@ id f0(MDATestDocument *d) { return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance'}} } +// rdar://20469452 +@interface UIView @end + +@interface FRFakeBannerView : UIView +@end + +@interface FRAdCollectionViewCell +@property (nonatomic, weak, readonly) UIView *bannerView; +@end + +@interface FRAdCollectionViewCell () + +@property (nonatomic, weak, readwrite) FRFakeBannerView *bannerView; + +@end