Skip to content

[4.2][CodeComplete] Fix crasher when completing inout IUO variable #17931

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 Jul 13, 2018

Cherry-pick of #17926 reviewed by @rudkx

  • Explaination: When code-completion tries to complete values, it annotates them with their types. Previously when completing inout arguments with IUO type, it used to crash. That was because there's wrong assumption that IUO types are always OptionalType. However, for inout case, it's actually a InOutType with underlying OptionalType. In this change, use ASTPrinter facility which correctly handles such case.
  • Scope: Affects completing inout values with IUO. e.g. func fn(arg: inout Int!) { ... }
  • Issue: rdar://problem/40956846
  • Risk: Low. ASTPrinter's type printing is well tested.
  • Testing: Added regression test cases.
  • Reviewed By: Mark Lacey ([CodeComplete] Fix crasher when completing inout IUO variable #17926)

Use `PrintOptionalAsImplicitlyUnwrapped` option.

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

rintaro commented Jul 13, 2018

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Jul 13, 2018

@swift-ci Please nominate

@rintaro rintaro changed the title [CodeComplete] Fix crasher when completing inout IUO variable [4.2][CodeComplete] Fix crasher when completing inout IUO variable Jul 13, 2018
@rintaro rintaro merged commit 00639e3 into swiftlang:swift-4.2-branch Jul 17, 2018
@rintaro rintaro deleted the 4.2-ide-complete-rdar40956846 branch July 17, 2018 05:43
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