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-13915] Support covariant self for final classes or final methods #56313

Closed
dabrahams opened this issue Nov 28, 2020 · 3 comments
Closed

[SR-13915] Support covariant self for final classes or final methods #56313

dabrahams opened this issue Nov 28, 2020 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-13915
Radar rdar://problem/71912819
Original Reporter @dabrahams
Type Bug
Status Closed
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 8faaa24a258d9c06bc00e30af22746cc

duplicates:

  • SR-11176 Covariant 'Self' type cannot be referenced from a stored property initializer

Issue Description:

Seems to me there's no reason both of these shouldn't compile:

final class X {
  init() {}
  func f(_: Self) {}
}
 
class X {
  init() {}
  final func f(_: Self) {}
}
@typesanitizer
Copy link

@swift-ci create

@swift-ci
Copy link
Collaborator

Comment by Frederick Kellison-Linn (JIRA)

Dupe of https://bugs.swift.org/browse/SR-11176 ?

@AnthonyLatsis
Copy link
Collaborator

The final method case should not compile since the class is not final and 'Self' therefore retains its dynamic status.

@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

4 participants