Files
swift-mirror/test/IRGen/rdar112792831.swift
Nate Chandler 3f069df550 [IRGen] Add metadata pack markers for destroys.
Destroys of values whose types feature a pack may require allocating the
pack on-stack.

Thanks to @slavapestov for the test case.

rdar://112792831
2023-07-24 14:19:24 -07:00

42 lines
1.2 KiB
Swift

// RUN: %target-swift-frontend -emit-ir -O %s
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public struct Predicate<each Input> {
var x: Any? = nil
public func evaluate(_: repeat each Input) -> Bool { return false }
}
public struct PredicateBindings {
}
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public protocol PredicateExpression<Output> {
associatedtype Output
func evaluate(_ bindings: PredicateBindings) throws -> Output
}
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public struct PredicateEvaluate<
Condition : PredicateExpression,
each Input : PredicateExpression
>
where
Condition.Output == Predicate<repeat (each Input).Output>
{
public typealias Output = Bool
public let predicate: Condition
public let input: (repeat each Input)
public init(predicate: Condition, input: repeat each Input) {
self.predicate = predicate
self.input = (repeat each input)
}
public func evaluate(_ bindings: PredicateBindings) throws -> Output {
try predicate.evaluate(bindings).evaluate(repeat (each input).evaluate(bindings))
}
}