Skip to content

[4.1] Restore a very narrow function argument conversion for -swift-version 4. #14480

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

Merged
merged 2 commits into from
Feb 8, 2018
Merged

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Feb 8, 2018

  • Explanation: We broke compatibility with treating function types that take Void as an argument as being allowed as arguments to functions expecting function types that take no arguments. We do not want to support this long term, but did up through Swift 4, so we shouldn't break it in Swift 4.1.

  • Scope of Issue: This particular case probably will not effect a large number of users directly, but this affects at least one popular project and could effect the users of that project.

  • Origination: A change was made to make function types more consistent, to avoid exactly this kind of "emergent behavior".

  • Risk: The fix here is very targeted, so the risk seems low.

  • Fixes: rdar://problem/36670720 / https://bugs.swift.org/browse/SR-6796

  • Reviewed By: @xedin

rudkx added 2 commits February 7, 2018 23:47
Allow functions with type `(()) -> T` to be passed in places where we
expect `() -> T`, but only for -swift-version 4 (for -swift-version 3
this already works due to other horrible things in CSSimplify.cpp).

We need to look at how we can help migrate these cases to
-swift-version 5, but in the meantime, but that is something we can
consider separately.

Fixes rdar://problem/36670720 / https://bugs.swift.org/browse/SR-6796

(cherry picked from commit 6310aca)
Move the existing test into Compatibility/tuple_arguments_4.swift.
Move the Swift 3 test, Compatibility/tuple_arguments.swift, into
Compatibility/tuple_arguments_4.swift.

Add a couple new tests to each file to capture what we do in each
mode.

Overall this doesn't seem like the most satisfying approach for
covering compatibility testing in our standard commit testing, but
it's all we've got at the moment.

(cherry picked from commit 5a02541)
@rudkx rudkx requested a review from xedin February 8, 2018 07:56
@rudkx
Copy link
Contributor Author

rudkx commented Feb 8, 2018

@swift-ci Please test

@rudkx
Copy link
Contributor Author

rudkx commented Feb 8, 2018

@swift-ci Please test source compatibility

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rudkx rudkx changed the title Restore a very narrow function argument conversion for -swift-version 4. [4.1] Restore a very narrow function argument conversion for -swift-version 4. Feb 8, 2018
@rudkx
Copy link
Contributor Author

rudkx commented Feb 8, 2018

@swift-ci please nominate

@rudkx rudkx merged commit aa97cee into swiftlang:swift-4.1-branch Feb 8, 2018
@rudkx rudkx deleted the fix-sr6796-4.1 branch February 8, 2018 16:29
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.

2 participants