Commit Graph

8 Commits

Author SHA1 Message Date
Mykola Pokhylets
89f8f8b9bf Wrap only changes related to the closure frontend logic 2025-08-02 20:24:46 +02:00
Mykola Pokhylets
ae48446716 Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved 2025-08-02 20:24:21 +02:00
Mike Ash
d0248afd14 [Test] Make implicit_weak_capture.swift more robust.
This test creates an object then checks a weak reference to that object on a background thread. It was doing this check after 10ms, and any small hiccup could potentially delay the object's destruction enough to spuriously fail.

Rearrange the test to check the weak reference in a loop for several seconds before giving up. This makes it very fast on success (it's done the moment it sees nil) while being robust against up to several seconds of delay in destroying the object if that happens.

rdar://149868181
2025-06-03 17:08:41 -04:00
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