Files
swift-mirror/test/Concurrency/Runtime/async_parameter_pack.swift
Slava Pestov b2e2b02a71 IRGen: Fix out-of-order task_dealloc with parameter pack metadata
We deallocate an instruction's packs at points where no further
control flow path uses the value. In the case of an alloc_stack,
this will be right after the dealloc_stack. Thus, if alloc_stack
allocates some packs to build type metadata for a tuple type
that contains a pack, and then proceeds to allocate a value
large enough to hold the tuple, we will free the second allocation
first, before we free the pack, as expected.

However, after stack allocating the value, alloc_stack does
some further work to emit debug info. This could result in
emission of additional metadata packs.

Split up the debug info emission into two parts; the first we do
before we perform the stack allocation, the rest we do after.

- Fixes https://github.com/swiftlang/swift/issues/67702.
- Fixes rdar://problem/141363236.
2025-05-15 12:22:21 -04:00

22 lines
387 B
Swift

// RUN: %target-run-simple-swift( -target %target-swift-5.9-abi-triple)
// REQUIRES: executable_test
// REQUIRES: concurrency
protocol P {
associatedtype A
var a: A { get }
}
func f<each T: P>(_ t: repeat each T) async -> (repeat (each T).A) {
let x = (repeat (each t).a)
return x
}
struct S: P {
var a: String { "" }
}
_ = await f()
_ = await f(S())
_ = await f(S(), S())