Skip to content

Commit 72104c1

Browse files
committed
SwiftCompilerSources: add CollectionLikeSequence.contains()
1 parent ad5ffb9 commit 72104c1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

SwiftCompilerSources/Sources/SIL/Value.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ public func !=(_ lhs: Value, _ rhs: Value) -> Bool {
154154
return !(lhs === rhs)
155155
}
156156

157+
extension CollectionLikeSequence where Element == Value {
158+
public func contains(_ element: Element) -> Bool {
159+
return self.contains { $0 == element }
160+
}
161+
}
162+
157163
/// A projected value, which is defined by the original value and a projection path.
158164
///
159165
/// For example, if the `value` is of type `struct S { var x: Int }` and `path` is `s0`,

0 commit comments

Comments
 (0)