Commit Graph

5 Commits

Author SHA1 Message Date
Hamish Knight
fe272e6cdd [Sema] Restore 5.10 implicit self behavior prior to Swift 6 mode
Unfortunately we've encountered another source
breaking case here:

```
class C {
  func method() {}

  func foo() {
    Task { [weak self] in
      Task {
        method()
      }
    }
  }
}
```

In 5.10 we'd only do the unqualified lookup for
`self` when directly in a `weak self` closure,
but with the implicit self rework, we'd start
using the `weak self` here, leading to a
type-checker error.

At this point, adding more edge cases to the
existing logic is going to make things much more
complicated. Instead, reinstate the 5.10 implicit
self lookup behavior and diagnostic logic,
switching over to the new logic only under Swift 6
mode.

rdar://129475277
2024-06-10 20:29:16 +01:00
Cal Stephens
8c5f783f5b [SE-0365] Fix issue where implicit self was unexpectedly disallowed in nested closures 2024-03-10 07:57:51 -07:00
Allan Shortlidge
74e55ef51f Test: Temporarily disable implicit_weak_capture.swift for back_deployment_runtime configs. 2022-11-10 18:21:21 -08:00
Andrew Trick
1ecf0a5586 implicit_weak_capture test requires Concurrency
Fixes rdar://101942652 (macOS 10.14.4) (Swift in the OS)
libswift_Concurrency; Symbol not found:
_swift_task_enterThreadLocalContext)
2022-11-03 19:35:47 -07:00
Cal Stephens
c081d56cf1 Add test case that implicit self in a weak closure doesn't result in a strong capture 2022-10-27 17:50:44 -07:00