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-949] Warn when Self is being redefined as generic #43561

Open
swift-ci opened this issue Mar 15, 2016 · 0 comments
Open

[SR-949] Warn when Self is being redefined as generic #43561

swift-ci opened this issue Mar 15, 2016 · 0 comments
Labels
compiler The Swift compiler itself improvement type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-949
Radar None
Original Reporter inket (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, TypeChecker
Assignee None
Priority Medium

md5: 968191e4dedab2396616e09ddaceb135

Issue Description:

Right now, it is impossible to restrict a protocol to a subclass of a specific class.

class Superclass {}
protocol Test {
    func f<Self: Superclass>(param: Self)
}

Trying to do so will appear to work, but in reality is a redefinition of Self which the compiler doesn't warn about.

Adding a warning would help developers determine what is actually happening in this case.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler itself improvement type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

1 participant