Skip to content

Disallow some implicit pointer conversions in autoclosures. #16623

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
May 16, 2018
Merged

Disallow some implicit pointer conversions in autoclosures. #16623

merged 2 commits into from
May 16, 2018

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented May 15, 2018

Disallow implicit conversion or arguments from Array, String, and
InOut (formed by &) to pointer types if the argument is for an
@autoclosure parameter.

These conversions were really only intended to be used for C/ObjC
interop, and in some contexts like autoclosures they are not safe.

Fixes: rdar://problem/31538995

@rudkx
Copy link
Contributor Author

rudkx commented May 15, 2018

@swift-ci Please smoke test

@rudkx
Copy link
Contributor Author

rudkx commented May 15, 2018

@swift-ci Please test source compatibility

@rudkx
Copy link
Contributor Author

rudkx commented May 15, 2018

The diagnostics for the & cases here are unfortunate.

@rudkx rudkx requested review from slavapestov and xedin May 15, 2018 08:14
@rudkx
Copy link
Contributor Author

rudkx commented May 15, 2018

@slavapestov I renamed an existing (and oddly named) locator to directly track type matches on the result of an auto closure expr.

@slavapestov
Copy link
Contributor

Nice, thanks!

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
Copy link
Contributor Author

rudkx commented May 16, 2018

swiftlang/swift-corelibs-foundation#1552

@swift-ci Please smoke test Linux platform

@rudkx rudkx changed the title Disallow implicit pointer conversions in autoclosures. Disallow some implicit pointer conversions in autoclosures. May 16, 2018
Disallow implicit conversion or arguments from Array, String, and
InOut (formed by &) to pointer types if the argument is for an
@autoclosure parameter.

These conversions were really only intended to be used for C/ObjC
interop, and in some contexts like autoclosures they are not safe.

Fixes: rdar://problem/31538995
@rudkx
Copy link
Contributor Author

rudkx commented May 16, 2018

@swift-ci Please smoke test

@rudkx
Copy link
Contributor Author

rudkx commented May 16, 2018

@swift-ci Please test source compatibility

@rudkx
Copy link
Contributor Author

rudkx commented May 16, 2018

@swift-ci Please smoke test Linux platform

@rudkx
Copy link
Contributor Author

rudkx commented May 16, 2018

@swift-ci Please test source compatibility

@rudkx rudkx merged commit bcb98fa into swiftlang:master May 16, 2018
@rudkx rudkx deleted the rdar31538995 branch May 16, 2018 23:07
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.

3 participants