Skip to content
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

[SR-1447] Concrete same-type requirements #44056

Closed
hartbit opened this issue May 8, 2016 · 0 comments
Closed

[SR-1447] Concrete same-type requirements #44056

hartbit opened this issue May 8, 2016 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@hartbit
Copy link
Collaborator

hartbit commented May 8, 2016

Previous ID SR-1447
Radar None
Original Reporter @hartbit
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 748721df6513bea682c4c047b386d207

duplicates:

  • SR-1009 Add methods to an Array containing a specific type

Issue Description:

From the Generics Manifesto:

Currently, a constrained extension cannot use a same-type constraint to make a type parameter equivalent to a concrete type. For example:

extension Array where Element == String {
  func makeSentence() -> String {
    // uppercase first string, concatenate with spaces, add a period, whatever
  }
}

This is a highly-requested feature that fits into the existing syntax and semantics. Note that one could imagine introducing new syntax, e.g., extending Array<String>, which gets into new-feature territory: see the section on "Parameterized extensions".

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant