xref: /llvm-project/clang/test/SemaObjC/override-nullability.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -Wnonnull %s -verify
2
3@interface NSObject @end
4
5@interface Base : NSObject
6- (nonnull id)bad:(nullable id)obj; // expected-note 2 {{previous declaration is here}}
7- (nullable id)notAsBad:(nonnull id)obj;
8@end
9
10@interface Sub : Base
11- (nullable id)bad:(nonnull id)obj; // expected-warning {{conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'nonnull'}} \
12                                    // expected-warning {{conflicting nullability specifier on parameter types, 'nonnull' conflicts with existing specifier 'nullable'}}
13- (nonnull id)notAsBad:(nullable id)obj;
14@end
15