Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Chris Lattner | a027b86 | 2007-12-12 06:22:14 +0000 | [diff] [blame] | 2 | |
Fariborz Jahanian | 1f7b6f8 | 2007-11-09 19:52:12 +0000 | [diff] [blame] | 3 | @interface foo |
| 4 | - (int)meth; |
| 5 | @end |
| 6 | |
| 7 | @implementation foo |
| 8 | - (int) meth { return [self meth]; } |
| 9 | @end |
| 10 | |
Chris Lattner | e8904e9 | 2008-08-23 01:48:03 +0000 | [diff] [blame] | 11 | // PR2708 |
| 12 | @interface MyClass |
| 13 | +- (void)myMethod; // expected-error {{expected selector for Objective-C method}} |
| 14 | - (vid)myMethod2; // expected-error {{expected a type}} |
| 15 | @end |
| 16 | |
| 17 | @implementation MyClass |
| 18 | - (void)myMethod { } |
Fariborz Jahanian | de73941 | 2008-12-05 01:35:25 +0000 | [diff] [blame] | 19 | - (vid)myMethod2 { } // expected-error {{expected a type}} |
Chris Lattner | 3aff919 | 2009-04-11 19:58:42 +0000 | [diff] [blame] | 20 | |
Chris Lattner | e8904e9 | 2008-08-23 01:48:03 +0000 | [diff] [blame] | 21 | @end |
| 22 | |
Chris Lattner | 3aff919 | 2009-04-11 19:58:42 +0000 | [diff] [blame] | 23 | |
| 24 | @protocol proto; |
| 25 | @protocol NSObject; |
| 26 | |
| 27 | //@protocol GrowlPluginHandler <NSObject> @end |
| 28 | |
| 29 | |
| 30 | @interface SomeClass2 |
| 31 | - (int)myMethod1: (id<proto>) |
| 32 | arg; // expected-note {{previous definition is here}} |
| 33 | @end |
| 34 | |
| 35 | @implementation SomeClass2 |
| 36 | - (int)myMethod1: (id<NSObject>) |
| 37 | arg { // expected-warning {{conflicting parameter types in implementation of 'myMethod1:': 'id<proto>' vs 'id<NSObject>'}} |
| 38 | |
| 39 | } |
| 40 | @end |