Skip to content

[4.0][Migrator] Migrate references to shorthand closure params (e.g. $0, $1) where affected by SE110 #9719

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

Conversation

nathawes
Copy link
Contributor

In Swift 3:

  1. a closure referring to $1 or above type checked against a function type that takes a single tuple argument with that arity
  2. a closure referring only to $0 (or $0.1 etc) type checked against a function type that takes multiple arguments

but neither compiles in Swift 4. This patch migrates shorthand references for:

  1. by prefixing "0." in front of the existing references, e.g. $1 to $0.1
  2. by removing the leading 0. if one exists or substituting a tuple of the correct arity if it doesn't, e.g. $0.1 to $1 and $0 to ($0, $1, $2)

Resolves rdar://problem/31969538

Nathan Hawes added 2 commits May 17, 2017 16:15
…1) where affected by SE110

In Swift 3:
 1) a closure referring to $1 or above type checked against a function type that takes a single tuple argument with that arity
 2) a closure referring only to $0 (or $0.1 etc) type checked against a function type that takes multiple arguments
but neither compiles in Swift 4.

This patch migrates shorthand references for
  1) by prefixing "0." in front of the existing references, e.g. "$1" to "$0.1"
  2) by removing the leading 0. if one existing or substituting a tuple of the correct arity if it doesn't, e.g. "$0.1" to "$1" and "$0" to "($0, $1, $2)"

Resolves rdar://problem/31969538
@nathawes
Copy link
Contributor Author

PR against master: #9711

@nathawes
Copy link
Contributor Author

@swift-ci Please test

@nathawes nathawes merged commit 0b899c5 into swiftlang:swift-4.0-branch May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant