-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Workaround type checker ambiguity in Comparable SwiftNewtypeWrapper #7024
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
Conversation
@DougGregor @parkera |
Did it used to type check but has regressed? |
@airspeedswift func acceptComparable<T : Comparable>(_: T) {}
acceptComparable(NSLocale.Key.calendar)
// <unknown>:0: error: type 'NSLocale.Key' does not conform to protocol 'Comparable'
// Swift.Comparable:144:24: note: multiple matching functions named '<=' with type '(NSLocale.Key, NSLocale.Key) -> Bool' |
This looks like a good change to me. You can add a test to |
85c249a
to
c784a9e
Compare
@DougGregor Thank you! I added
|
c784a9e
to
f11b741
Compare
@swift-ci please smoke test and merge |
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
In macOS,
didn't typecheck because of ambiguity.
This PR adds an additional constraint to
Comparable
functions for_SwiftNewTypeWrapper
,just like
func !=
forEquatable, RawRepresentable
.