diff options
author | Douglas Gregor <dgregor@apple.com> | 2015-07-07 03:58:01 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2015-07-07 03:58:01 +0000 |
commit | c575231ea9dfccafa44d5c49ea05063fb3efb7fc (patch) | |
tree | 15168d9354bb612209fb8adc641a8a5de8710788 /test/SemaObjC/conditional-expr-8.m | |
parent | a6620f3825bfe120c96c1bac7d62e0dcd34f33a0 (diff) |
Improve the Objective-C common-type computation used by the ternary operator.
The Objective-C common-type computation had a few problems that
required a significant rework, including:
- Quadradic behavior when finding the common base type; now it's
linear.
- Keeping around type arguments when computing the common type
between a specialized and an unspecialized type
- Introducing redundant protocol qualifiers.
Part of rdar://problem/6294649. Also fixes rdar://problem/19572837 by
addressing a longstanding bug in
ASTContext::CollectInheritedProtocols().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241544 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC/conditional-expr-8.m')
-rw-r--r-- | test/SemaObjC/conditional-expr-8.m | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/SemaObjC/conditional-expr-8.m b/test/SemaObjC/conditional-expr-8.m index beddd205a9..35f4e75314 100644 --- a/test/SemaObjC/conditional-expr-8.m +++ b/test/SemaObjC/conditional-expr-8.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // expected-no-diagnostics -// rdar://9296866 +// rdar://9296866 @interface NSResponder @end @@ -24,3 +24,34 @@ } @end +// rdar://problem/19572837 +@protocol NSObject +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> +@end + +@protocol Goable <NSObject> +- (void)go; +@end + +@protocol Drivable <Goable> +- (void)drive; +@end + +@interface Car : NSObject +- (NSObject <Goable> *)bestGoable:(NSObject <Goable> *)drivable; +@end + +@interface Car(Category) <Drivable> +@end + +@interface Truck : Car +@end + +@implementation Truck +- (NSObject <Goable> *)bestGoable:(NSObject <Goable> *)drivable value:(int)value{ + return value > 0 ? self : drivable; +} +@end |