Fariborz Jahanian | b107143 | 2011-04-18 21:16:59 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Andy Gibbs | c6e68da | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Fariborz Jahanian | b107143 | 2011-04-18 21:16:59 +0000 | [diff] [blame] | 3 | |
Douglas Gregor | c5e07f5 | 2015-07-07 03:58:01 +0000 | [diff] [blame] | 4 | // rdar://9296866 |
Fariborz Jahanian | b107143 | 2011-04-18 21:16:59 +0000 | [diff] [blame] | 5 | @interface NSResponder |
| 6 | @end |
| 7 | |
| 8 | |
| 9 | @interface NSView : NSResponder |
| 10 | @end |
| 11 | |
| 12 | @interface WebView : NSView |
| 13 | @end |
| 14 | |
| 15 | @protocol WebDocumentView |
| 16 | @end |
| 17 | |
| 18 | @implementation NSView |
| 19 | |
| 20 | - (void) FUNC : (id)s { |
| 21 | WebView *m_webView; |
| 22 | NSView <WebDocumentView> *documentView; |
| 23 | NSView *coordinateView = s ? documentView : m_webView; |
| 24 | } |
| 25 | @end |
| 26 | |
Douglas Gregor | c5e07f5 | 2015-07-07 03:58:01 +0000 | [diff] [blame] | 27 | // rdar://problem/19572837 |
| 28 | @protocol NSObject |
| 29 | @end |
| 30 | |
| 31 | __attribute__((objc_root_class)) |
| 32 | @interface NSObject <NSObject> |
| 33 | @end |
| 34 | |
| 35 | @protocol Goable <NSObject> |
| 36 | - (void)go; |
| 37 | @end |
| 38 | |
| 39 | @protocol Drivable <Goable> |
| 40 | - (void)drive; |
| 41 | @end |
| 42 | |
| 43 | @interface Car : NSObject |
| 44 | - (NSObject <Goable> *)bestGoable:(NSObject <Goable> *)drivable; |
| 45 | @end |
| 46 | |
| 47 | @interface Car(Category) <Drivable> |
| 48 | @end |
| 49 | |
| 50 | @interface Truck : Car |
| 51 | @end |
| 52 | |
| 53 | @implementation Truck |
| 54 | - (NSObject <Goable> *)bestGoable:(NSObject <Goable> *)drivable value:(int)value{ |
| 55 | return value > 0 ? self : drivable; |
| 56 | } |
| 57 | @end |