Skip to content

Conversation

hamishknight
Copy link
Contributor

6.0 cherry-pick of #73976

  • Explanation: Fixes a regression that would cause us to error on an implicit use of self in a weak self captured closure passed to an @_implicitSelfCapture parameter, e.g Task's initializer.
  • Scope: Adds a missed case to the warning downgrade logic for the invalid implicit self diagnostic.
  • Issue: rdar://128941797
  • Risk: Low, this strictly causes us to warn in more cases
  • Testing: Added tests to test suite
  • Reviewer: Cal Stephens

…ture`

In 5.10 we warned on this:

```swift
func bar(@_implicitSelfCapture _ fn: @escaping () -> Void) {}

class C {
  func foo() {
    bar { [weak self] in
      foo()
    }
  }
}
```

But with the implicit self rework, this accidentally
became an error. Fix it to ensure we continue to
warn until Swift 6 mode.

rdar://128941797
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit eb92e6e into swiftlang:release/6.0 Jun 4, 2024
@hamishknight hamishknight deleted the implicit-self-fix-6.0 branch June 4, 2024 17:51
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 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants