view clang/test/SemaObjC/nullable-weak-property.m @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1d019706d866
children
line wrap: on
line source

// 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