Files
swift-mirror/validation-test/compiler_crashers_fixed/rdar119212867.swift
Hamish Knight 4e811c3a88 [test] Merge crasher directories
There is no longer much of a good reason to keep these separate,
merge them.
2025-10-18 12:51:30 +01:00

46 lines
858 B
Swift

// RUN: %target-swift-frontend -emit-ir %s -disable-availability-checking
protocol P {
func evaluate(_ item: Int) -> Bool
}
struct G<each F: P>: P {
init(filters: repeat each F) {
self.filters = (repeat each filters)
}
var filters: (repeat each F)
func evaluate(_ item: Int) -> Bool {
var result = true
(repeat result.and((each filters).evaluate(item)))
return result
}
}
private extension Bool {
mutating func and(_ other: @autoclosure () -> Bool) {
self = self && other()
}
}
struct S1: P {
func evaluate(_ item: Int) -> Bool {
print("S1", item)
return false
}
}
struct S2: P {
func evaluate(_ item: Int) -> Bool {
print("S2", item)
return false
}
}
do {
let filter = G(filters: S1(), S2())
print(filter.evaluate(5))
}