NSAppleScript methods missing “nullable” tag
| Originator: | adam | ||
| Number: | rdar://26404391 | Date Originated: | 21-May-2016 12:43 PM |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | Xcode 7.3.1 (7D1014) |
| Classification: | Other Bug | Reproducible: | Always |
Summary: Two methods in the NSAppleScript class indicate that they can return nil, but are not marked as nullable: // Execute the script, compiling it first if it is not already compiled. Return the result of executing the script, or nil and a pointer to an error information dictionary for failure. - (NSAppleEventDescriptor *)executeAndReturnError:(NSDictionary<NSString *, id> * __nullable * __nullable)errorInfo; // Execute an Apple event in the context of the script, compiling the script first if it is not already compiled. Return the result of executing the event, or nil and a pointer to an error information dictionary for failure. - (NSAppleEventDescriptor *)executeAppleEvent:(NSAppleEventDescriptor *)event error:(NSDictionary<NSString *, id> * __nullable * __nullable)errorInfo; Steps to Reproduce: 1. Write code that uses NSAppleScript. See attached sample. 2. Call executeAndReturnError(_:) or executeAppleEvent(_:error:), and use its return value to determine success or failure. Expected Results: Code works as predicted. Actual Results: Clang complains that the return value is not nullable. NSAppleScript-nullability-bug.swift:7:4: error: initializer for conditional binding must have Optional type, not 'NSAppleEventDescriptor' Version: Xcode 7.3.1 (7D1014) Configuration: OS X 10.11.4 Attachments: 'NSAppleScript-nullability-bug.swift' was successfully uploaded.
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!