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-9051] Cannot call a protocol method returning Self in a tuple type on an existential #51554

Closed
hamishknight opened this issue Oct 20, 2018 · 0 comments
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

@hamishknight
Copy link
Collaborator

Previous ID SR-9051
Radar None
Original Reporter @hamishknight
Type Bug
Status Resolved
Resolution Duplicate
Environment

Swift version 4.2-dev (LLVM c4a0883115, Clang 0a99881462, Swift 533575ab62)
Target: x86_64-apple-darwin17.7.0

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

md5: e59125b45533bbfce9faaa478e0523d2

duplicates:

  • SR-2672 Implement tuple conversion

Issue Description:

The following doesn't compile:

protocol P {}
extension P {
  func foo() -> (Self, String) { return (self, "") }
}

func bar(_ x: P) {
  let y = x.foo() // error: Cannot express tuple conversion '(P, String)' to '(P, String)'
}

However it does compile when foo() returns Self directly:

protocol P {}
extension P {
  func foo() -> Self { return self }
}

func bar(_ x: P) {
  let y = x.foo() // fine.
}
@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

1 participant