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-731] Covariant overrides don't work with protocols #43346

Closed
gribozavr opened this issue Feb 14, 2016 · 0 comments
Closed

[SR-731] Covariant overrides don't work with protocols #43346

gribozavr opened this issue Feb 14, 2016 · 0 comments
Assignees
Labels
compiler The Swift compiler in itself conformances Feature → protocol: protocol conformances duplicate Resolution: Duplicates another issue feature A feature request or implementation improvement protocol Feature → type declarations: Protocol declarations type checker Area → compiler: Semantic analysis

Comments

@gribozavr
Copy link
Collaborator

gribozavr commented Feb 14, 2016

Previous ID SR-731
Radar rdar://problem/24646146
Original Reporter @gribozavr
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: f4da7056e0a0c6070f5fcbe33735666a

duplicates:

  • SR-522 Protocol funcs cannot have covariant returns

relates to:

  • SR-733 Contravariant overrides on return type don't work with protocols

Issue Description:

I expect foo2() to compile, because foo1() compiles:

protocol P1 {}
protocol P1x : P1 {}

class C1 {}
class C1x : C1 {}

class Base {
  func foo1(_: C1x) {}
  func foo2(_: P1x) {}
}
class Derived : Base {
  override func foo1(_: C1) {} // OK
  override func foo2(_: P1) {} // error: method does not override any method from its superclass
}
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added duplicate Resolution: Duplicates another issue feature A feature request or implementation conformances Feature → protocol: protocol conformances protocol Feature → type declarations: Protocol declarations type checker Area → compiler: Semantic analysis improvement and removed bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. labels Jan 27, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself conformances Feature → protocol: protocol conformances duplicate Resolution: Duplicates another issue feature A feature request or implementation improvement protocol Feature → type declarations: Protocol declarations type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants