Skip to content

[4.2][Migrator] Use RewriteBuffer::InsertText() for applying insertion #16204

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Apr 27, 2018

Cherry-pick of #16171 reviewed by @nkcsgexi

Apparently, ReplaceText() on the same location replaces the replaced
text. Using InsertText() fixes the problem.
This problem used to cause a invalid migration. For example:

_ = FooBar(SomeThing)

// Renaming: FooBar(_:) → Foo.bar(someThing:)
_ = FooBar(someThing: SomeThing)

// Renaming: SomeValue → Some.val
_ = Foo.bar(Some.valg: SomeThing)

rdar://problem/39518867

Apparently, ReplaceText() on the same location replaces the replaced
text. Using InsertText() fixes the problem.

rdar://problem/39518867
@rintaro
Copy link
Member Author

rintaro commented Apr 27, 2018

@swift-ci Please test

@rintaro rintaro changed the title [Migrator] Use RewriteBuffer::InsertText() for applying insertion [4.2][Migrator] Use RewriteBuffer::InsertText() for applying insertion Apr 27, 2018
@rintaro
Copy link
Member Author

rintaro commented Apr 27, 2018

@swift-ci Please test

@rintaro rintaro merged commit afbfae4 into swiftlang:swift-4.2-branch Apr 27, 2018
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.

1 participant