mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Lifetime inference: restructure to support multiple dependencies.
Restructure the inference logic to allow the same function declaration to
independently annotate or infer different lifetime targets.
For example:
@_lifetime(borrow a)
/* DEFAULT: @_lifetime(b: copy b)
func f(a: A, b: inout B) -> NE
The fact that we prevented this was somewhat accidental and surprising.
This restructuring simplifies the code but also gives us much more control over
the inference logic.
Fixes: rdar://159288750 ("A function cannot have a ~Escapable 'inout' parameter
in addition to other ~Escapable parameters" is not actionable)
This commit is contained in:
@@ -218,7 +218,7 @@ public:
|
||||
addressableParamIndicesAndImmortal(addressableParamIndices, isImmortal),
|
||||
conditionallyAddressableParamIndices(conditionallyAddressableParamIndices),
|
||||
targetIndex(targetIndex) {
|
||||
assert(this->isImmortal() || inheritLifetimeParamIndices ||
|
||||
ASSERT(this->isImmortal() || inheritLifetimeParamIndices ||
|
||||
scopeLifetimeParamIndices);
|
||||
ASSERT(!inheritLifetimeParamIndices ||
|
||||
!inheritLifetimeParamIndices->isEmpty());
|
||||
|
||||
Reference in New Issue
Block a user