Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 // expected-no-diagnostics
      3 
      4 // rdar://9296866
      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 
     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
     58