annotate clang/test/SemaObjC/nullable-weak-property.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -Wnullable-to-nonnull-conversion %s -verify
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 // rdar://19985330
anatofuz
parents:
diff changeset
5 @interface NSObject @end
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 @class NSFoo;
anatofuz
parents:
diff changeset
8 void foo (NSFoo * _Nonnull);
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 @interface NSBar : NSObject
anatofuz
parents:
diff changeset
11 @property(weak) NSFoo *property1;
anatofuz
parents:
diff changeset
12 @end
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 #pragma clang assume_nonnull begin
anatofuz
parents:
diff changeset
15 @interface NSBar ()
anatofuz
parents:
diff changeset
16 @property(weak) NSFoo *property2;
anatofuz
parents:
diff changeset
17 @end
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 #pragma clang assume_nonnull end
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 @implementation NSBar
anatofuz
parents:
diff changeset
22 - (void) Meth {
anatofuz
parents:
diff changeset
23 foo (self.property1); // no warning because nothing is inferred
anatofuz
parents:
diff changeset
24 foo (self.property2); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * _Nullable' to non-nullable pointer type 'NSFoo * _Nonnull'}}
anatofuz
parents:
diff changeset
25 }
anatofuz
parents:
diff changeset
26 @end