Debian Codegraph @

clang/test/SemaObjC/nullable-weak-property.m

raw
1 // RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -Wnullable-to-nonnull-conversion %s -verify
2
3 @interface NSObject @end
4
5 @class NSFoo;
6 void foo (NSFoo * _Nonnull);
7
8 @interface NSBar : NSObject
9 @property(weak) NSFoo *property1;
10 @end
11
12 #pragma clang assume_nonnull begin
13 @interface NSBar ()
14 @property(weak) NSFoo *property2;
15 @end
16
17 #pragma clang assume_nonnull end
18
19 @implementation NSBar
20 - (void) Meth {
21 foo (self.property1); // no warning because nothing is inferred
22 foo (self.property2); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * _Nullable' to non-nullable pointer type 'NSFoo * _Nonnull'}}
23 }
24 @end