Skip to content
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

[SR-8536] Warn on member assignments capturing self #51055

Open
CodaFi opened this issue Aug 14, 2018 · 2 comments
Open

[SR-8536] Warn on member assignments capturing self #51055

CodaFi opened this issue Aug 14, 2018 · 2 comments
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement type checker Area → compiler: Semantic analysis

Comments

@CodaFi
Copy link
Member

CodaFi commented Aug 14, 2018

Previous ID SR-8536
Radar None
Original Reporter @CodaFi
Type Improvement
Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Improvement, StarterBug, TypeChecker
Assignee tt (JIRA)
Priority Medium

md5: cb331d15432b248f57b7b7bce4d077f7

Issue Description:

class Foo {
  let bar: () -> ()

  func baz() {}

  init() {
    self.bar = baz // We oughta warn about capturing 'self' implicitly.
  }
}

In the example above, we should warn about capturing `self` implicitly and, rather than suggest the user make it explicit, probably offer a fixit that provides a closure with a weak or unowned capture.

@belkadan
Copy link
Contributor

Resetting assignees on all Starter Bugs that haven't been touched since 2018.

@swift-ci
Copy link
Collaborator

Comment by Tapan Thaker (JIRA)

Implementing this in PR 35473

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants