mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Make sure we set the correct DeclContext for CSGen of multi-statement closure captures, since otherwise the DeclContext is set to the closure itself, which is wrong.
21 lines
436 B
Swift
21 lines
436 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// https://github.com/swiftlang/swift/issues/79444
|
|
class C {
|
|
func foo() {
|
|
_ = { [x = "\(self)"] in } // expected-warning {{capture 'x' was never used}}
|
|
_ = { [x = "\(self)"] in x }
|
|
_ = { [x = "\(self)"] in
|
|
let y = x
|
|
return y
|
|
}
|
|
_ = { [x = "\(self)"] in
|
|
let fn = { [y = "\(x)"] in
|
|
let z = y
|
|
return z
|
|
}
|
|
return fn()
|
|
}
|
|
}
|
|
}
|