25 lines · plain
1// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -Wnullable-to-nonnull-conversion %s -verify2 3@interface NSObject @end4 5@class NSFoo;6void foo (NSFoo * _Nonnull);7 8@interface NSBar : NSObject9@property(weak) NSFoo *property1;10@end11 12#pragma clang assume_nonnull begin13@interface NSBar ()14@property(weak) NSFoo *property2;15@end16 17#pragma clang assume_nonnull end18 19@implementation NSBar 20- (void) Meth {21 foo (self.property1); // no warning because nothing is inferred22 foo (self.property2); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * _Nullable' to non-nullable pointer type 'NSFoo * _Nonnull'}}23}24@end25