Skip to content

[MiscDiagnostics] Warn if magic identifiers don’t match #29341

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 3 commits into from
Jan 22, 2020

Conversation

beccadax
Copy link
Contributor

@beccadax beccadax commented Jan 21, 2020

When wrapping a function which is supposed to capture the caller’s location, there’s always a risk that the wrapper won’t capture the information the wrapped function wants; for instance, you might pass (…, line, column) where the callee expected (…, column, line).

This PR emits a warning when a call passes an explicit argument to something that has a default argument, and that explicit argument is itself a parameter with a default argument, and both parameters use magic identifiers, but they use different magic identifiers. This is partially in support of concise #file, but applies to all magic identifiers.

Fixes rdar://problem/58588633.

These now return nullptr for parameter-list-free types; previously those would have failed a cast.
When wrapping a function which is supposed to capture the caller’s location, there’s always a risk that the wrapper won’t capture the information the wrapped function wants; for instance, you might pass `(…, line, column)` where the callee expected `(…, column, line)`.

This commit emits a warning when a call passes an explicit argument to something that has a default argument, and that explicit argument is itself a parameter with a default argument, and both parameters use magic identifiers, but they use *different* magic identifiers.  This is partially in support of concise #file, but applies to all magic identifiers.

Fixes rdar://problem/58588633.
@beccadax beccadax requested a review from xedin January 21, 2020 22:30
@beccadax
Copy link
Contributor Author

@swift-ci please test

@beccadax beccadax merged commit 7df141c into swiftlang:master Jan 22, 2020
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