Skip to content

Commit 8a91e98

Browse files
authored
[Sema] Don't look through CoerceExprs in markDirectCallee (#27085)
[Sema] Don't look through CoerceExprs in markDirectCallee
2 parents 02b5e56 + 1b7da04 commit 8a91e98

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -894,12 +894,6 @@ namespace {
894894
continue;
895895
}
896896

897-
// Coercions can be used for disambiguation.
898-
if (auto coerce = dyn_cast<CoerceExpr>(callee)) {
899-
callee = coerce->getSubExpr();
900-
continue;
901-
}
902-
903897
// We're done.
904898
break;
905899
}

test/Sema/suppress-argument-labels-in-types.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,21 @@ class C0 {
204204

205205
// Check diagnostics changes.
206206
let _ = min(Int(3), Float(2.5)) // expected-error{{cannot convert value of type 'Float' to expected argument type 'Int'}}
207+
208+
// SR-11429
209+
func testIntermediateCoercions() {
210+
_ = (f1 as (Int, Int) -> Int)(a: 0, b: 1) // expected-error {{extraneous argument labels 'a:b:' in call}}
211+
_ = (f1 as (Int, Int) -> Int)(0, 1)
212+
213+
typealias Magic<T> = T
214+
_ = (f1 as Magic)(a: 0, b: 1) // expected-error {{extraneous argument labels 'a:b:' in call}}
215+
_ = (f1 as Magic)(0, 1)
216+
217+
_ = (f4 as (Int, Int) -> Int)(0, 0)
218+
_ = (f4 as (Double, Double) -> Double)(0, 0)
219+
220+
func iuoReturning() -> Int! {}
221+
_ = (iuoReturning as () -> Int?)()
222+
_ = (iuoReturning as Magic)()
223+
_ = (iuoReturning as () -> Int)() // expected-error {{cannot convert value of type '() -> Int?' to type '() -> Int' in coercion}}
224+
}

0 commit comments

Comments
 (0)