No Compiler Warning When Using NSMenu.items Setter

Originator:hello
Number:rdar://45517851 Date Originated:24-Oct-2018 07:38 AM
Status:Open Resolved:
Product:macOS + SDK Product Version:10.0 (10A255)
Classification:Other Bug Reproducible:Always
 
Summary:
In macOS 10.14, NSMenu.items has a setter that can be used to update the menu items (`menu.items = [item1, item2]`). This is new to macOS 10.14 — in previous macOS versions, menu items had to be added using the `addItem` method (`menu.addItem(item1)`).

The issue is, Xcode does not show an error when using the `menu.items` setter when compiling an app for pre-10.14 macOS versions.

Steps to Reproduce:
1. Open a macOS codebase, and set its deployment target to something lower than 10.14
2. In the code, create a new NSMenu — `let menu = NSMenu()`
3. Attempt to use the menu’s items setter to add a menu item — `menu.items = [NSMenuItem(…)]`
4. Build and run on a machine running 10.14, and note that there are no build warnings or console errors

Expected Results:
I would expect to see some sort of error displayed, saying that the `NSMenu.items` setter is inaccessible to macOS versions prior to 10.14.

Actual Results:
No error is displayed notifying me of the issue.

Version:
10.0 (10A255)

Notes:

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!