Files
TheRock/compiler/amd-llvm/clang/test/SemaObjC/property-user-setter.m
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

155 lines
3.2 KiB
Objective-C

// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
@interface I0
@property(readonly) int x;
@property(readonly) int y;
@property(readonly) int z;
-(void) setY: (int) y0;
@end
@interface I0 (Cat0)
-(void) setX: (int) a0;
@end
@implementation I0
@dynamic x;
@dynamic y;
@dynamic z;
-(void) setY: (int) y0{}
-(void) im0 {
self.x = 0;
self.y = 2;
self.z = 2; // expected-error {{assignment to readonly property}}
}
@end
// Test when property is 'readonly' but it has a setter in
// its implementation only.
@interface I1 {
}
@property(readonly) int identifier;
@end
@implementation I1
@dynamic identifier;
- (void)setIdentifier:(int)ident {}
- (id)initWithIdentifier:(int)Arg {
self.identifier = 0;
}
@end
// Also in a category implementation
@interface I1(CAT)
@property(readonly) int rprop;
@end
@implementation I1(CAT)
@dynamic rprop;
- (void)setRprop:(int)ident {}
- (id)initWithIdentifier:(int)Arg {
self.rprop = 0;
}
@end
static int g_val;
@interface Root
+ alloc;
- init;
@end
@interface Subclass : Root
{
int setterOnly;
}
- (void) setSetterOnly:(int)value;
@end
@implementation Subclass
- (void) setSetterOnly:(int)value {
setterOnly = value;
g_val = setterOnly;
}
@end
@interface C {}
// - (int)Foo;
- (void)setFoo:(int)value;
@end
void g(int);
void f(C *c) {
c.Foo = 17; // OK
g(c.Foo); // expected-error {{no getter method for read from property}}
}
void abort(void);
int main (void) {
Subclass *x = [[Subclass alloc] init];
x.setterOnly = 4; // OK
if (g_val != 4)
abort ();
return 0;
}
@interface rdar11363363
{
id R;
}
@property (copy) id p;
@property (copy) id r;
@property (copy) id Q;
@property (copy) id t; // expected-note 2 {{property declared here}}
@property (copy) id T; // expected-note 2 {{property declared here}}
@property (copy) id Pxyz; // expected-note 2 {{property declared here}}
@property (copy) id pxyz; // expected-note 2 {{property declared here}}
@end
@implementation rdar11363363
@synthesize p;
@synthesize r;
@synthesize Q;
@synthesize t, T;
@synthesize Pxyz, pxyz;
- (id) Meth {
self.P = 0; // expected-warning {{property 'P' not found on object of type 'rdar11363363 *'; did you mean to access property p?}}
self.q = 0; // expected-warning {{property 'q' not found on object of type 'rdar11363363 *'; did you mean to access property Q?}}
self.t = 0; // expected-error {{synthesized properties 't' and 'T' both claim setter 'setT:'}}
self.T = 0; // expected-error {{synthesized properties 'T' and 't' both claim setter 'setT:'}}
self.Pxyz = 0; // expected-error {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
self.pxyz = 0; // expected-error {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
self.r = 0;
return self.R; // expected-error {{no getter method for read from property}} \
// expected-warning {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access property r?}}
}
@end
@class BridgeFormatter;
@interface FMXBridgeFormatter
@property(assign, readwrite, getter=formatter, setter=setFormatter:) BridgeFormatter* cppFormatter;
@end
@implementation FMXBridgeFormatter
@synthesize cppFormatter;
- (void) dealloc
{
self.formatter = 0;
}
@end