Skip to content

Fix another subtle SE-0110-related break. #10847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,9 +1082,8 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
if (auto elt = locator.last()) {
if (elt->getKind() == ConstraintLocator::ApplyArgToParam) {
if (auto *paren2 = dyn_cast<ParenType>(func2Input.getPointer())) {
func2Input = paren2->getUnderlyingType();
if (auto *paren1 = dyn_cast<ParenType>(func1Input.getPointer()))
func1Input = paren1->getUnderlyingType();
if (!isa<ParenType>(func1Input.getPointer()))
func2Input = paren2->getUnderlyingType();
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions test/Constraints/tuple_arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1551,3 +1551,26 @@ extension Sequence where Iterator.Element == (key: String, value: String?) {
}
}
}

func rdar33043106(_ records: [(Int)], _ other: [((Int))]) -> [Int] {
let x: [Int] = records.flatMap { _ in
let i = 1
return i
}
let y: [Int] = other.flatMap { _ in
let i = 1
return i
}

return x + y
}

func itsFalse(_: Int) -> Bool? {
return false
}

func rdar33159366(s: AnySequence<Int>) {
_ = s.flatMap(itsFalse)
let a = Array(s)
_ = a.flatMap(itsFalse)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: not %target-swift-frontend -swift-version 4 %s -typecheck
// RUN: %target-swift-frontend -swift-version 4 %s -typecheck

func flatterMap(_ records: [(Int)]) -> [Int] {
records.flatMap { _ in return 1 } // expected-note {{}}
Expand Down

This file was deleted.