Closed jegnux closed 6 years ago
Attachment: Download
is duplicated by:
Issue Description:
Using a KeyPath of a new property is possible without any availability check, leading to a crash at runtime.
Create a project with iOS 10.0 as iOS deployment target
In a UIViewController, write this line:
navigationItem[keyPath: \UINavigationItem.largeTitleDisplayMode] = .always
Have a compiler error:
'largeTitleDisplayMode' is only available on iOS 11.0 or newer
Have following Xcode fix-it:
Add 'if #available' version check Add @available attribute to enclosing instance method Add @available attribute to enclosing class
No compiler error, warning or wathever
When the code is run on iOS 10, an unrecognized selector sent to instance exception is thrown
@swift-ci create
https://github.com/apple/swift/pull/17778
Attachment: Download
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, KeyPaths | |Assignee | None | |Priority | Medium | md5: d56d2e77f97faa4da5f5f1f09f41acf5is duplicated by:
Issue Description:
Description
Using a KeyPath of a new property is possible without any availability check, leading to a crash at runtime.
Steps to reproduce
Create a project with iOS 10.0 as iOS deployment target
In a UIViewController, write this line:
Expected Results
Have a compiler error:
Have following Xcode fix-it:
Actual Results
No compiler error, warning or wathever
When the code is run on iOS 10, an unrecognized selector sent to instance exception is thrown