Skip to content

[GSB] Infer requirements from uses of generic typealiases. #15439

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

Merged
merged 3 commits into from
Mar 22, 2018

Conversation

DougGregor
Copy link
Member

Generic typealiases can add requirements that aren't used by their
underlying type. For example, CountableRange in the standard library:

  public typealias CountableRange<Bound: Comparable> = Range<Bound>

Perform requirement inference based on uses of generic typealiases,
such that a generic function like this:

  func f<T>(_: CountableRange<T>) { }

will infer T: Bound from the use of CountableRange.

Note that this does not yet work for extensions, but it does fix rdar://problem/29231937

Generic typealiases can add requirements that aren't used by their
underlying type. For example, CountableRange in the standard library:

  public typealias CountableRange<Bound: Comparable> = Range<Bound>

Perform requirement inference based on uses of generic typealiases,
such that a generic function like this:

  func f<T>(_: CountableRange<T>) { }

will infer T: Bound from the use of CountableRange.

Note that this does not yet work for extensions.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit 99051b5 into swiftlang:master Mar 22, 2018
@DougGregor DougGregor deleted the gsb-infer-generic-typealias branch March 22, 2018 23:09
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.

1 participant