Skip to content

[5.3][CodeCompletion] Suggest 'Self' inside struct, enum and classe #32288

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 Jun 10, 2020

Cherry-pick of #32053 into release/5.3

  • Explanation: Since SE-0068 (Expanding Swift Self to class members and value types), Self can be used anywhere in struct and enum, and any function body in class. This patch adds Self for expression completions whenever it is usable.
  • Scope: Global expression completion
  • Risk: Low. This is purely additional change, it doesn't affect the current functionality.
  • Testing: Added regression test cases
  • Issue: rdar://problem/61307680
  • Reviewer: Ben Langmuir (@benlangmuir)

In 'protocol', 'Self' is implicitly declared as a generic parameter.
In 'struct' and 'enum', 'Self' is just an alias for the nominal type.
In 'class', 'Self' is a dynamic type and usable only in result types and
inside function bodies.

rdar://problem/61307680
(cherry picked from commit 3b97b86)
@rintaro rintaro added the r5.3 label Jun 10, 2020
@rintaro rintaro requested a review from a team as a code owner June 10, 2020 01:49
@rintaro
Copy link
Member Author

rintaro commented Jun 10, 2020

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Jun 10, 2020

@swift-ci Please nominate

@tkremenek tkremenek merged commit 1517ceb into swiftlang:release/5.3 Jun 10, 2020
@AnthonyLatsis AnthonyLatsis added swift 5.3 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants