Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Steve Naroff | ed91f90 | 2009-04-02 18:37:59 +0000 | [diff] [blame] | 3 | |
| 4 | @interface Test {} |
| 5 | + (Test*)one; |
| 6 | - (int)two; |
| 7 | @end |
| 8 | |
| 9 | int main () |
| 10 | { |
| 11 | return Test.one.two; |
| 12 | } |
| 13 | |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 14 | // rdar://16650575 |
| 15 | __attribute__((objc_root_class)) |
| 16 | @interface RootClass { |
| 17 | Class isa; |
| 18 | } |
| 19 | |
| 20 | @property int property; |
| 21 | -(int)method; |
| 22 | - (void) setMethod : (int)arg; |
| 23 | +(int)classMethod; |
| 24 | @end |
| 25 | |
| 26 | @interface Subclass : RootClass @end |
| 27 | void Test1() { |
| 28 | // now okay |
| 29 | (void)RootClass.property; |
| 30 | (void)Subclass.property; |
| 31 | (void)RootClass.method; |
| 32 | (void)Subclass.method; |
| 33 | |
| 34 | RootClass.property = 1; |
| 35 | Subclass.property = 2; |
| 36 | RootClass.method = 3; |
| 37 | Subclass.method = 4; |
| 38 | |
| 39 | // okay |
| 40 | (void)RootClass.classMethod; |
| 41 | (void)Subclass.classMethod; |
| 42 | |
| 43 | // also okay |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 44 | (void)[RootClass property]; |
| 45 | (void)[Subclass property]; |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 46 | [RootClass method]; |
| 47 | [Subclass method]; |
| 48 | [RootClass classMethod]; |
| 49 | [Subclass classMethod]; |
| 50 | |
| 51 | // also okay |
| 52 | [RootClass setProperty : 1]; |
| 53 | [Subclass setProperty : 2]; |
| 54 | [RootClass setMethod : 3]; |
| 55 | [Subclass setMethod : 4]; |
| 56 | } |