mirror of
https://github.com/apple/swift.git
synced 2026-10-14 15:51:20 +02:00
If an InFlightSubstitution has an active pack expansion, then substituting a PackArchetypeType could cause a PackElementType to be introduced, possibly erroneously. ProtocolConformanceRef::forAbstract cannot handle PackElementType types, so set the PreservePackExpansionLevel flag prevents this.
23 lines
886 B
Swift
23 lines
886 B
Swift
// RUN: %target-swift-frontend -emit-sil -verify %s
|
|
|
|
// Verify that CapturePromotion does not crash when remapping the substitution
|
|
// map of a partial_apply whose conformances include a pack conformance.
|
|
//
|
|
// Cloning the closure below remaps a partial_apply of '!=' that carries a pack
|
|
// conformance for 'Pack{repeat each V} : Equatable'. Substituting that pack
|
|
// conformance enters an active pack expansion; the cloner's no-substitution-map
|
|
// conformance fallback must not project a pack element lane onto the conforming
|
|
// type, which previously produced an invalid PackElementType subject and
|
|
// aborted in ProtocolConformanceRef::forAbstract.
|
|
//
|
|
// rdar://175912818
|
|
|
|
public func crash<each V: Equatable & Sendable>(
|
|
action: sending @escaping (repeat (each V, Bool)) -> ()
|
|
) -> ((repeat each V)) -> ()
|
|
{
|
|
{ o in
|
|
action(repeat (each o, false || (each o != each o)))
|
|
}
|
|
}
|