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-7413] SourceKit implies extensions to generic types are constrained #49956

Closed
natecook1000 opened this issue Apr 11, 2018 · 4 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@natecook1000
Copy link
Member

Previous ID SR-7413
Radar rdar://problem/39414022
Original Reporter @natecook1000
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug
Assignee @natecook1000
Priority Medium

md5: c59d0511f5c32100f740918b2169d7d3

Issue Description:

In the Swift generated interface, extensions to generic types with constraints on their generic parameters all show that constraint. This implies that the extensions (and the conformances they add) are conditionally available, even though they're always there. For example, Set constrains its Element type to Hashable, and every extension for Set in the generated interface shows the where Element : Hashable constraint:

extension Set : ExpressibleByArrayLiteral where Element : Hashable {

    /// Creates a set containing the elements of the given array literal.
    /// ...
    public init(arrayLiteral elements: Set<Element>.Element...)
}

extension Set : Sequence where Element : Hashable {

    /// Returns an iterator over the members of the set.
    public func makeIterator() -> SetIterator<Element>

    /// Returns a Boolean value that indicates whether the given element exists
    /// in the set.
    /// ...
    public func contains(_ member: Set<Element>.Element) -> Bool
}

This is technically correct, since the constraint is met for all these extensions, but it's superfluous and confusing for readers of the interface.

@natecook1000
Copy link
Member Author

@belkadan
Copy link
Contributor

@swift-ci create

@belkadan
Copy link
Contributor

#18779

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

@natecook1000, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@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.
Projects
None yet
Development

No branches or pull requests

2 participants