-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-0046] Implementation for consistent func labels #2047
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
[SE-0046] Implementation for consistent func labels #2047
Conversation
ac9d274
to
7cae734
Compare
C : Collection where C.Iterator.Element == Base.Iterator.Element | ||
>( | ||
bounds: Range<Base.Index>, with newElements: C | ||
subRange bounds: Range<Base.Index>, with newElements: C |
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 don't change the standard library API. It was already audited and it conforms to the guidelines.
@manavgabhawala Thank you! I am extremely concerned about false positives. 95% is good, but not perfect. We can't allow any unintended changes in the standard library API. Did you manually audit all of the changes to the |
@manavgabhawala Great job! I definitely share @gribozavr's concerns about API -- it's tedious but you'll need to manually verify your regex didn't cause any unintended API changes. |
@gribozavr @harlanhaskins I did not use the regex for any of the stdlib changes for exactly that reason. I did not change any of the APIs other than the replaceSubrange function (and not just in String, in all the containers), is because almost all of the declarations were of the form replaceSubrange(_ subRange:,with:) so I thought this might be an easier change to do. However if you want, I can go ahead and change all of these back to the original form. |
I think it's probably best to change it back for this pull request. |
There are some conflict markers scattered throughout |
@harlanhaskins will fix, thanks for the catch |
ed2f09a
to
6207d38
Compare
@harlanhaskins fixed all the changes requested |
Were those conflicts from abfecfd? Thanks for fixing those so quickly! I'm gonna take another look over the changes to make sure nothing stands out. |
No I think they were from 9ce9784180be8ebc7744a7a295c6006f543da344. I had fixed them but I think I forgot to save the file before I rebased. But it should be fixed now. There are always conflicts every time there are new commits since this PR changes a lot of files. Yeah absolutely, please make sure nothing stands out. |
We're also going to need to have branches ready to go in SPM, corelibs, lldb, and xctest, because as soon as Top-of-Tree I'll coordinate with @mxcl, @parkera, @ddunbar, @modocache, and @eschaton to get their projects ready. |
Great, sounds good. Let me know if there's anything I can help with |
@@ -69,8 +69,8 @@ public protocol _ArrayBufferProtocol : MutableCollection { | |||
/// | |||
/// - Precondition: This buffer is backed by a uniquely-referenced | |||
/// `_ContiguousArrayBuffer`. | |||
mutating func replace<C : Collection where C.Iterator.Element == Element>( | |||
subRange subRange: Range<Int>, | |||
mutating func replaceSubrange<C : Collection where C.Iterator.Element == Element>( |
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.
Lingering API change here
I can't see the file right now in GitHub's diff view (too many changes 😂), but whilst running tests I found a conflict marker in |
@@ -392,8 +391,8 @@ extension _ArrayBuffer { | |||
} | |||
else { | |||
var refCopy = self | |||
refCopy.replace( | |||
subRange: i...i, with: 1, elementsOf: CollectionOfOne(newValue)) | |||
refCopy.replaceSubrange( |
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.
API change here
@manavgabhawala Also it looks like the extra diagnostics didn't get deleted from |
@harlanhaskins I know. I hoped to get at least some CI feedback. |
And we have some:
|
Interesting! I didn't get that one when I built with |
Oh, these are new changes from master? |
@harlanhaskins can I rebase now, if you are done reviewing? so that I can fixup the new extra commits that I pushed and also get all the new changes to master? |
Yes, absolutely! Thanks again! We're going to coordinate this with corelibs-foundation, XCTest, lldb, and SPM, to get all of these merged together at the same time. There will undoubtedly be at least one more rebase in your future. |
906c6fd
to
a6d2029
Compare
@swift-ci Please test |
@swift-ci Please smoke test |
Smoke test passed. Are we set to merge? @gribozavr We'll need to coordinate with swiftlang/swift-corelibs-xctest#92 and swiftlang/swift-corelibs-foundation#305 |
Some conflicts just arose 😕 @manavgabhawala Mind fixing these and squashing into one commit? |
You just need to delete the definitions for |
@harlanhaskins do you want just one commit total, or squash into the current 5, correctly? |
@manavgabhawala One commit total, if possible. |
…ng extraneous parameter names and adding _ where necessary
a6d2029
to
7928140
Compare
@harlanhaskins done. Should we re- smoke test? |
@manavgabhawala I don't think that will be necessary. @gribozavr? |
Thank you, @manavgabhawala! |
What's in this pull request?
Implements SE-0046 to provide consistent function labels (i.e. the first parameter no longer has special behavior for function labels).
I separated out the changes into separate commits depending on the part being changed so that its easier to review since this is a massive change across the entire repo. However, if it is preferred that this is merged as a single commit, I would be happy to squash into one commit.
I updated most of the swift code using Regex find and replace (and then manual verification where necessary) and since a lot of other repos are going to suffer source code breaking changes to make it easier for them, here are the regex strings I used:
For regular (non-generic) functions I did a search for
func ([_a-zA-Z0-9]+?)(\s*?)\((\s*?)([a-zA-Z0-9]+?)(\s*?):
and replaced withfunc \1\2(\3_ \4\5:
By estimation this worked about 95% of the time and almost never found any false positives.For generic functions I did a second search using:
func ([_a-zA-Z0-9]+?)(\s*?)(<[\s\S]*?>)(\s*?)\((\s*?)([a-zA-Z0-9]+?)(\s*?):
and replaced withfunc \1\2\3\4(\5_ \6\7:
This worked about 90% of the time but be warned it does tend to find false positives (rarely).Resolved bug number:
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
Validation Testing
Note: Only members of the Apple organization can trigger swift-ci.