summaryrefslogtreecommitdiff
path: root/test/SemaObjC/nullable-weak-property.m
blob: 7de7edf1eee60edaca96e83155239dc4c48f1003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -Wnullable-to-nonnull-conversion %s -verify


// rdar://19985330
@interface NSObject @end

@class NSFoo;
void foo (NSFoo * _Nonnull);

@interface NSBar : NSObject
@property(weak) NSFoo *property1;
@end

#pragma clang assume_nonnull begin
@interface NSBar ()
@property(weak) NSFoo *property2;
@end

#pragma clang assume_nonnull end

@implementation NSBar 
- (void) Meth {
   foo (self.property1); // no warning because nothing is inferred
   foo (self.property2); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * _Nullable' to non-nullable pointer type 'NSFoo * _Nonnull'}}
}
@end