Skip to content

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

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 #9307

merged 1 commit into from
May 5, 2017

Conversation

bitjammer
Copy link
Contributor

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-ci Please smoke test

@akyrtzi
Copy link
Contributor

akyrtzi commented May 5, 2017

LGTM.

@bitjammer bitjammer merged commit 4a12ab5 into swiftlang:master May 5, 2017
@bitjammer bitjammer deleted the rdar-31666638-31665649-migrator-string-substring-fixit branch May 5, 2017 02:07
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