SR-8622 Nonnull Objective-C property that falsely returns nil causes inconsistent Swift behavior
Issue Description:
If Swift code receives nil from a function declared in Objective-C which is marked as returning nonull, and the return value of that function is passed into an Objective-C function, that function will receive an instance of NSNull instead of nil, regardless of whether that function's parameter is annotated nonnull or nullable. In other words:
{{ let liar = Liar() // Implemented in Objective-C}}
{{ let obj = liar.totallyNotNull() // returns nil}}
{{ liar.takeNonNull(obj) // receives NSNull}}
{{ liar.takeNull(obj) // receives NSNull}}
The text was updated successfully, but these errors were encountered:
Attachment: Download
Environment
Xcode Version 9.2 (9C40b).
Additional Detail from JIRA
md5: 76a08820f5a43a2ab494244c11a754e2
relates to:
Issue Description:
If Swift code receives
nil
from a function declared in Objective-C which is marked as returningnonull
, and the return value of that function is passed into an Objective-C function, that function will receive an instance ofNSNull
instead ofnil
, regardless of whether that function's parameter is annotatednonnull
ornullable
. In other words:{{ let liar = Liar() // Implemented in Objective-C}}
{{ let obj = liar.totallyNotNull() // returns nil}}
{{ liar.takeNonNull(obj) // receives NSNull}}
{{ liar.takeNull(obj) // receives NSNull}}
The text was updated successfully, but these errors were encountered: