-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Fix-it] Support defaulted and variadic arguments in renamed fix-it #3998
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
f44555e
to
f193169
Compare
Updated |
@swift-ci Please smoke test |
@DougGregor Mind reviewing this? |
|
||
let ptr1 = UnsafeMutablePointer<T>(allocatingCapacity: 1) // expected-error {{'init(allocatingCapacity:)' is unavailable: use 'UnsafeMutablePointer.allocate(capacity:)'}} {{none}} | ||
ptr1.initialize(with: e, count: 1) // expected-error {{'initialize(with:count:)' has been renamed to 'initialize(to:count:)'}} | ||
ptr1.initialize(with: e, count: 1) // expected-error {{'initialize(with:count:)' has been renamed to 'initialize(to:count:)'}} {{8-18=initialize}} {{19-23=to}} {{none}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
c6262cc
to
8f5fca0
Compare
@swift-ci Please smoke test |
} | ||
break; | ||
} | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the actual case(s) here, so that it's a fully-covered switch. That way we can get warnings if someone adds a new kind of tuple shuffle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use explicit case
value here,
because the subject value is basically a index of the arguments.
I think the assertion below (suffleIdx == (I - argumentLabelIDs.begin()
)
will catch any new kind of special value.
Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, that makes sense. I wasn't reading closely enough and assumed it was a real enum. Thanks!
This looks great! Some more possible test cases: func defaultBeforeRequired(a: Int = 1, b: Int) {}
defaultBeforeRequired(b: 5)
func defaultPlusTrailingClosure(a: Int = 1, b: Int = 2, c: () -> Void) {}
defaultPlusTrailingClosure {}
defaultPlusTrailingClosure(c: {})
defaultPlusTrailingClosure(a: 1) {} |
@jrose-apple Thank you for test case suggestion! I will add them. 👍 |
@swift-ci Please smoke test |
return; | ||
} | ||
argExpr = args->getSubExpr(); | ||
auto I = argumentLabelIDs.begin(); | ||
for (auto suffleIdx : elementMap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/suffleIdx/shuffleIdx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh. 💨
9da4388
to
375b87c
Compare
@swift-ci Please smoke test |
Unrelated failure on Linux. merging. |
Given all our renames, this seems useful enough to pull into the 3.0 branch. I'll make a pull request for that. |
[Fix-it] Support defaulted and variadic arguments in renamed fix-it (cherry picked from commit 3db6fd2)
What's in this pull request?
CC: @jrose-apple
Renamed fix-it used to give-up emitting fix-it for argument labels if the arguments have some defaulted or variadic arguments.
This PR should address
UnsafeMutablePointer.initalize(with:count:)
fix-it.https://bugs.swift.org/browse/SR-2264
I will add some formal test cases for these stdlib renames totest/1_stdlib/Renames.swift
.Done.
Resolved bug number: (SR-2264)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
A smoke test on macOS does the following:
device standard libraries are not built.
version of these tests are not run.
A smoke test on Linux does the following:
tests are not run.
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.