Skip to content

Commit

Permalink
Update tests after deprecating flatMap variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Moiseev committed Dec 18, 2017
1 parent 8ec6c45 commit 96d3439
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion test/Constraints/casts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ _ = b1 as Int // expected-error {{cannot convert value of type 'Bool' to type
_ = seven as Int // expected-error {{cannot convert value of type 'Double' to type 'Int' in coercion}}

func rdar29894174(v: B?) {
let _ = [v].flatMap { $0 as? D }
let _ = [v].filterMap { $0 as? D }
}

// When re-typechecking a solution with an 'is' cast applied,
Expand Down
6 changes: 3 additions & 3 deletions test/Constraints/closures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,12 @@ let _: ((Int?) -> Void) = { (arg: Int!) in }
// () -> T to () -> Optional<()>.
func returnsArray() -> [Int] { return [] }

returnsArray().flatMap { $0 }.flatMap { }
returnsArray().filterMap { $0 }.filterMap { }
// expected-warning@-1 {{expression of type 'Int' is unused}}
// expected-warning@-2 {{result of call to 'flatMap' is unused}}
// expected-warning@-2 {{result of call to 'filterMap' is unused}}

// rdar://problem/30271695
_ = ["hi"].flatMap { $0.isEmpty ? nil : $0 }
_ = ["hi"].filterMap { $0.isEmpty ? nil : $0 }

// rdar://problem/32432145 - compiler should emit fixit to remove "_ in" in closures if 0 parameters is expected

Expand Down
8 changes: 4 additions & 4 deletions test/Constraints/tuple_arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1554,11 +1554,11 @@ extension Sequence where Iterator.Element == (key: String, value: String?) {
}

func rdar33043106(_ records: [(Int)], _ other: [((Int))]) -> [Int] {
let x: [Int] = records.flatMap { _ in
let x: [Int] = records.map { _ in
let i = 1
return i
}
let y: [Int] = other.flatMap { _ in
let y: [Int] = other.map { _ in
let i = 1
return i
}
Expand All @@ -1571,9 +1571,9 @@ func itsFalse(_: Int) -> Bool? {
}

func rdar33159366(s: AnySequence<Int>) {
_ = s.flatMap(itsFalse)
_ = s.filterMap(itsFalse)
let a = Array(s)
_ = a.flatMap(itsFalse)
_ = a.filterMap(itsFalse)
}

func sr5429<T>(t: T) {
Expand Down

0 comments on commit 96d3439

Please sign in to comment.