mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
33 lines
1.0 KiB
Swift
33 lines
1.0 KiB
Swift
// RUN: %target-typecheck-verify-swift %s
|
|
|
|
func flatMapOnSequence<
|
|
S : Sequence
|
|
>(xs: S, f: (S.Element) -> S.Element?) {
|
|
_ = xs.flatMap(f) // expected-warning {{deprecated}} expected-note {{compactMap}}
|
|
}
|
|
|
|
func flatMapOnLazySequence<
|
|
S : LazySequenceProtocol
|
|
>(xs: S, f: (S.Element) -> S.Element?) {
|
|
_ = xs.flatMap(f) // expected-warning {{deprecated}} expected-note {{compactMap}}
|
|
}
|
|
|
|
func flatMapOnLazyCollection<
|
|
C : LazyCollectionProtocol
|
|
>(xs: C, f: (C.Element) -> C.Element?) {
|
|
_ = xs.flatMap(f) // expected-warning {{deprecated}} expected-note {{compactMap}}
|
|
}
|
|
|
|
func flatMapOnLazyBidirectionalCollection<
|
|
C : LazyCollectionProtocol & BidirectionalCollection
|
|
>(xs: C, f: (C.Element) -> C.Element?)
|
|
where C.Elements : BidirectionalCollection {
|
|
_ = xs.flatMap(f) // expected-warning {{deprecated}} expected-note {{compactMap}}
|
|
}
|
|
|
|
func flatMapOnCollectinoOfStrings<
|
|
C : Collection
|
|
>(xs: C, f: (C.Element) -> String?) {
|
|
_ = xs.flatMap(f) // expected-warning {{deprecated}} expected-note {{compactMap}}
|
|
}
|