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-3102] Protocol conformance constraint doesn't work under certain circumstances #45690

Closed
swift-ci opened this issue Nov 1, 2016 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Nov 1, 2016

Previous ID SR-3102
Radar None
Original Reporter tonisuter (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Tested with:
Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)
Apple Swift version 3.0-dev (LLVM 3e3d712024, Clang 1ce5868628, Swift aea9d83)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee @slavapestov
Priority Medium

md5: 97fe5acdaf34cea2a2b16aace2556bee

Issue Description:

The following extension on Array works as expected:

extension Array where Element: CustomStringConvertible {
    func f(_ x: Element) -> String {
        return x.description
    }
}

But when I use Iterator.Element instead, I get an error message (error: value of type 'Element' has no member 'description'):

extension Array where Iterator.Element: CustomStringConvertible {
    func f(_ x: Iterator.Element) -> String {
        return x.description
    }
}

However, this should work since Array is a Sequence and since Iterator.Element and Element refer to the same type, namely the type of the array elements.

@slavapestov
Copy link
Member

Works on master.

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants