Skip to content

Commit 9f68dee

Browse files
authored
Merge pull request #10847 from rudkx/fix-rdar33043106
Fix another subtle SE-0110-related break.
2 parents 8de2416 + 8d9f97c commit 9f68dee

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,9 +1082,8 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
10821082
if (auto elt = locator.last()) {
10831083
if (elt->getKind() == ConstraintLocator::ApplyArgToParam) {
10841084
if (auto *paren2 = dyn_cast<ParenType>(func2Input.getPointer())) {
1085-
func2Input = paren2->getUnderlyingType();
1086-
if (auto *paren1 = dyn_cast<ParenType>(func1Input.getPointer()))
1087-
func1Input = paren1->getUnderlyingType();
1085+
if (!isa<ParenType>(func1Input.getPointer()))
1086+
func2Input = paren2->getUnderlyingType();
10881087
}
10891088
}
10901089
}

test/Constraints/tuple_arguments.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,3 +1551,26 @@ extension Sequence where Iterator.Element == (key: String, value: String?) {
15511551
}
15521552
}
15531553
}
1554+
1555+
func rdar33043106(_ records: [(Int)], _ other: [((Int))]) -> [Int] {
1556+
let x: [Int] = records.flatMap { _ in
1557+
let i = 1
1558+
return i
1559+
}
1560+
let y: [Int] = other.flatMap { _ in
1561+
let i = 1
1562+
return i
1563+
}
1564+
1565+
return x + y
1566+
}
1567+
1568+
func itsFalse(_: Int) -> Bool? {
1569+
return false
1570+
}
1571+
1572+
func rdar33159366(s: AnySequence<Int>) {
1573+
_ = s.flatMap(itsFalse)
1574+
let a = Array(s)
1575+
_ = a.flatMap(itsFalse)
1576+
}

validation-test/compiler_crashers_2_fixed/0111-rdar33067102.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not %target-swift-frontend -swift-version 4 %s -typecheck
1+
// RUN: %target-swift-frontend -swift-version 4 %s -typecheck
22

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

validation-test/compiler_crashers_2_fixed/0113-rdar33067102-2.swift

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)