Skip to content

[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

Closed

Conversation

DougGregor
Copy link
Member

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.

huonw and others added 14 commits November 26, 2017 21:48
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.
@DougGregor DougGregor force-pushed the reversed-cond-conformance branch from 68294be to ff34491 Compare November 27, 2017 05:49
@DougGregor
Copy link
Member Author

Current status: the standard library type-check, but crash with an assertion in IRGen.

@DougGregor
Copy link
Member Author

DougGregor commented Nov 27, 2017

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.
@DougGregor
Copy link
Member Author

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!

@DougGregor
Copy link
Member Author

Note that #13089 covers the remaining compiler fixes needed to get everything building. Associated type inference will be tackled separately.

@DougGregor
Copy link
Member Author

@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'}:
Copy link
Contributor

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>
Copy link
Contributor

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?

@DougGregor
Copy link
Member Author

We'll work from the original pull request.

@DougGregor DougGregor closed this Nov 29, 2017
@DougGregor DougGregor deleted the reversed-cond-conformance branch November 29, 2017 01:05
@airspeedswift
Copy link
Member

@DougGregor you mean my original PR? I have some more changes, should I go back to that one and continue making them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants