Short version of ternary operator triggers an invalid nullability warning

Originator:michaelhochs
Number:rdar://25166556 Date Originated:2016-03-15
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.2.1
Classification:Other bug Reproducible:Always
 
Summary:
When using the short version of the ternary operator to verify that a method returns a nonnull value, this triggers a warning that this check is insufficient, which is incorrect.

Steps to Reproduce:
0. Open the attached sample project (ensure 'Incorrect Uses of Nullable Values' is set to YES in the build settings, which should be the case in the attached sample)
1. Compile it
2. Look at the warnings

Expected Results:
There should be no warnings (also see the comment in AppDelegate.m)

Actual Results:
The warning "Implicit conversion from nullable pointer 'NSString * _Nullable' to non-nullable pointer type 'NSString * _Nonnull'" is triggered.

Version:
Xcode 7.2.1 / iOS 9.2.1

Notes:


Configuration:


Attachments:
'TernaryOperatorNullableWarning.zip' was successfully uploaded.

Attached sample project can be found at: https://github.com/michaelochs/radars/tree/master/25166556%20-%20TernaryOperatorNullableWarning

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!