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-9484] Accepts invalid where clauses for associated types #51946

Closed
jepers opened this issue Dec 12, 2018 · 3 comments
Closed

[SR-9484] Accepts invalid where clauses for associated types #51946

jepers opened this issue Dec 12, 2018 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@jepers
Copy link

jepers commented Dec 12, 2018

Previous ID SR-9484
Radar None
Original Reporter @jepers
Type Bug
Environment

Xcode 10.1 default toolchain and recent snapshots

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 87628fd70d4bc413b5d6c5a47a32780d

Issue Description:

I guess the following should not compile (but it does):

protocol P {
    associatedtype A
    associatedtype B where B == A
}

protocol Q where A == B {
    associatedtype A
    associatedtype B
}

protocol R where A == (B, C) {
    associatedtype A
    associatedtype B
    associatedtype C
}

protocol S where A == (B, C) -> D {
    associatedtype A
    associatedtype B
    associatedtype C
    associatedtype D
}
@belkadan
Copy link
Contributor

@DougGregor, @slavapestov, are these supposed to be forbidden?

@DougGregor
Copy link
Member

I thought we had agreed that this was okay, although it certainly does feel a bit odd to refer to something in the current protocol this way.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@slavapestov
Copy link
Member

This code is fine, protocol where clauses can reference the protocol's own associated types.

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

4 participants