1 // TEST_CONFIG MEM=mrc,gc
5 #import <Foundation/NSObject.h>
7 @interface Sub : NSObject @end
9 +(id)allocWithZone:(NSZone *)zone {
10 testprintf("in +[Sub alloc]\n");
11 return [super allocWithZone:zone];
14 testprintf("in -[Sub dealloc]\n");
20 // These declarations and definitions can be used
21 // to check the compile-time type of an object.
22 @interface NSObject (Checker)
23 // fixme this isn't actually enforced
24 +(void)NSObjectInstance __attribute__((unavailable));
26 @implementation NSObject (Checker)
27 -(void)NSObjectInstance { }
28 +(void)NSObjectClass { }
30 @interface Sub (Checker)
31 -(void)NSObjectInstance __attribute__((unavailable));
32 +(void)NSObjectClass __attribute__((unavailable));
34 @implementation Sub (Checker)
35 -(void)SubInstance { }
42 [[Sub new] autorelease];
45 // Verify that dot syntax on class objects works with some instance methods
46 // (void)NSObject.self; fixme
48 (void)NSObject.superclass;
50 (void)NSObject.description;
51 (void)NSObject.debugDescription;
53 // Verify that some methods return the correct type.
55 NSObject *nsobject = nil;
58 cls = [NSObject self];
60 nsobject = [nsobject self];
61 subobject = [subobject self];
62 [[NSObject self] NSObjectClass];
63 [[nsobject self] NSObjectInstance];
64 [[Sub self] SubClass];
65 [[subobject self] SubInstance];
68 // cls = NSObject.self;
70 // [NSObject.self NSObjectClass];
71 // [nsobject.self NSObjectInstance];
72 // [Sub.self SubClass];
73 // [subobject.self SubInstance];
75 cls = [NSObject class];
76 cls = [nsobject class];
78 cls = [subobject class];
79 [[NSObject class] NSObjectClass];
80 [[nsobject class] NSObjectClass];
81 [[Sub class] SubClass];
82 [[subobject class] SubClass];
87 cls = subobject.class;
88 [NSObject.class NSObjectClass];
89 [nsobject.class NSObjectClass];
91 [subobject.class SubClass];
94 cls = [NSObject superclass];
95 cls = [nsobject superclass];
96 cls = [Sub superclass];
97 cls = [subobject superclass];
98 [[NSObject superclass] NSObjectClass];
99 [[nsobject superclass] NSObjectClass];
100 [[Sub superclass] NSObjectClass];
101 [[subobject superclass] NSObjectClass];
103 cls = NSObject.superclass;
104 cls = nsobject.superclass;
105 cls = Sub.superclass;
106 cls = subobject.superclass;
107 [NSObject.superclass NSObjectClass];
108 [nsobject.superclass NSObjectClass];
109 [Sub.superclass NSObjectClass];
110 [subobject.superclass NSObjectClass];