-
Notifications
You must be signed in to change notification settings - Fork 339
Use FoundationEssentials if it's available #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,9 +9,14 @@ | |||||
// | ||||||
//===----------------------------------------------------------------------===// | ||||||
|
||||||
#if swift(>=5.11) | ||||||
#if swift(>=6.0) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
#if canImport(FoundationEssentials) | ||||||
internal import protocol FoundationEssentials.LocalizedError | ||||||
internal import class FoundationEssentials.NSError | ||||||
#else | ||||||
internal import protocol Foundation.LocalizedError | ||||||
internal import class Foundation.NSError | ||||||
#endif | ||||||
#elseif swift(>=5.10) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok this actually exposes an issue - |
||||||
import protocol Foundation.LocalizedError | ||||||
import class Foundation.NSError | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment that Swift 6 language mode needs to be enabled for these guards to work (which it is not in Package.swift).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be addressed by using
#if compiler
instead, as in provided suggestions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks @MaxDesiatov!