-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Still thoroughly unmergeable] Adopt conditional conformance for Indices, Slice, ReversedCollection #13064
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
[Still thoroughly unmergeable] Adopt conditional conformance for Indices, Slice, ReversedCollection #13064
Conversation
XCTest had XCAssert(Not)Equal overloads for optionals, arrays (including contiguous arrays and array slices), and dictionaries to work around the lack of conditional conformances to Equatable. Now that we have the latter, remove the former. Fixes rdar://problem/17924430.
It's always had the ability to be Equatable, but it didn't make sense before because Dictionary wasn't Equatable.
… types. Type witness inference is failing in a large number of places due to the adoption of conditional conformances in Slice. Add the necessary typealiases to get the standard library to type-check. This is a hack that can be reverted once type witness inference is improved.
68294be
to
ff34491
Compare
Current status: the standard library type-check, but crash with an assertion in IRGen. |
Current IRGen assertion: https://bugs.swift.org/browse/SR-6478 |
…bles. We'll need to re-use this logic for witness table accessors.
When emitting a witness table accessor (e.g., an associated type metadata or associated type conformance accessor) for a conditional conformance, bind the conditional requirements so we can refer to them within that accessor. Witness methods get this behavior already through the SelfWitnessTable parameter, but everything the witness table needs it. Fixes most of SR-6478.
…tiation function. A witness table instantiation function can end up referring to conditional requirements to, e.g., fill in base witness tables. Store the conditional requirements first, and also bind the witness tables for conditional requirements within the local scope so they can be used directly. Fixes SR-6478.
Add explicit typealiases to help work around associated type inference bugs uncovered by the adoption of more conditional conformances in the standard library.
With these new commits, we're now able to build the standard library, all of the overlays, etc. The standard library binary dylib is 709kb smaller on macOS (~6%) than before. Associated type inference is still broken, and there are a whole bunch of test suite failures, but it's a start! |
Note that #13089 covers the remaining compiler fixes needed to get everything building. Associated type inference will be tackled separately. |
@swift-ci please smoke test |
_elements: self, | ||
startIndex: self.startIndex, | ||
endIndex: self.endIndex) | ||
} | ||
} | ||
|
||
% end | ||
public typealias DefaultBidirectionalIndices<T: BidirectionalCollection> = DefaultIndices<T> | ||
public typealias DefaultRandomAccessIndices<T: RandomAccessCollection> = DefaultIndices<T> | ||
|
||
// ${'Local Variables'}: |
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.
This stuff in the end is not needed anymore, since the file has been ungybbed.
_elements: self, | ||
startIndex: self.startIndex, | ||
endIndex: self.endIndex) | ||
} | ||
} | ||
|
||
% end | ||
public typealias DefaultBidirectionalIndices<T: BidirectionalCollection> = DefaultIndices<T> |
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.
@airspeedswift do we want these typealiases permanently deprecated
?
We'll work from the original pull request. |
@DougGregor you mean my original PR? I have some more changes, should I go back to that one and continue making them? |
My version of #12913 that includes various compiler and standard library hacks/fixes/workarounds to make progress on rolling out conditional conformances in the library.