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-2600] Closure cannot infer tuple parameter names - Regression #45205

Closed
swift-ci opened this issue Sep 9, 2016 · 3 comments
Closed

[SR-2600] Closure cannot infer tuple parameter names - Regression #45205

swift-ci opened this issue Sep 9, 2016 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 3.0 type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Sep 9, 2016

Previous ID SR-2600
Radar rdar://problem/28226355
Original Reporter bolismauro (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Version 8.0 (8A218a)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, 3.0Regression, TypeChecker
Assignee None
Priority Medium

md5: 1bdeab2b5e4c5d274ff865fa6c08d0aa

Issue Description:

This code doesn't work starting from Xcode 8 GM

typealias Closure<A, B> = ((a: A, b: B)) -> String

func invoke<A, B>(a: A, b: B, _ closure: Closure<A,B>) {
  print(closure((a, b)))
}

// error: value of tuple type '(_, _)' has no member 'b'
invoke(a: 1, b: "B") { $0.b }

// this works
invoke(a: 1, b: "B") { $0.1 }

// this works
invoke(a: 1, b: "B") { (c: (a: Int, b: String)) in
  return c.b
}

// this doesn't work: error: value of tuple type '(_, _)' has no member 'b'
invoke(a: 1, b: "B") { c in
  return c.b
}

It used to work on previous Xcode 8 versions

@belkadan
Copy link
Contributor

belkadan commented Sep 9, 2016

Yep, we still have problems distinguishing "one argument that's a tuple" from "multiple arguments".

@belkadan
Copy link
Contributor

belkadan commented Sep 9, 2016

More fallout from SE-0110.

@slavapestov
Copy link
Member

This appears to be working in Swift 3.1. I'll add a test.

@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 regression swift 3.0 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants