Skip to content

[Migrator] Suggest String <-> Substring conversions #9314

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 1 commit into from
May 5, 2017
Merged

[Migrator] Suggest String <-> Substring conversions #9314

merged 1 commit into from
May 5, 2017

Conversation

bitjammer
Copy link
Contributor

@bitjammer bitjammer commented May 5, 2017

Some APIs that expected a String now expect a Substring and vice
versa. To ease the transition, emit fix-its on conversion errors
between these types that the migrator can pick up.

When converting from Substring -> String, suggest wrapping in
String.init.

When converting from String -> Substring, suggest appending the
void subscript []. (This isn't implemented yet so this is
hidden behind a flag).

This can possibly be generalized later when converting between
some sequence and its subsequence, such as Array and ArraySlice,
for example.

rdar://problem/31665649
rdar://problem/31666638

Some APIs that expected a String now expect a Substring and vice
versa. To ease the transition, emit fix-its on conversion errors
between these types that the migrator can pick up.

When converting from Substring -> String, suggest wrapping in
`String.init`.

When converting from String -> Substring, suggest appending the
void subscript `[]`. (This isn't implemented yet so this is
hidden behind a flag).

This can possibly be generalized later when converting between
some sequence and its subsequence, such as Array and ArraySlice,
for example.

rdar://problem/31665649
rdar://problem/31666638
@bitjammer
Copy link
Contributor Author

Swift-4.0-branch cherry-pick of #9307

@bitjammer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 5, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 39b137f
Test requested by - @bitjammer

@bitjammer
Copy link
Contributor Author

Looks like the node timed out during swiftpm tests. I'll try again.

@bitjammer
Copy link
Contributor Author

@swift-ci Please test

@bitjammer
Copy link
Contributor Author

All good now.

@bitjammer bitjammer merged commit 8d14ee2 into swiftlang:swift-4.0-branch May 5, 2017
@bitjammer bitjammer deleted the rdar-31665649-migrator-string-substring-swift-4.0-branch branch May 5, 2017 19:05
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