File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -2235,6 +2235,10 @@ class RemoveInvalidCall final : public ConstraintFix {
22352235
22362236 bool diagnose (const Solution &solution, bool asNote = false ) const override ;
22372237
2238+ bool diagnoseForAmbiguity (CommonFixesArray commonFixes) const override {
2239+ return diagnose (*commonFixes.front ().first );
2240+ }
2241+
22382242 static RemoveInvalidCall *create (ConstraintSystem &cs,
22392243 ConstraintLocator *locator);
22402244
@@ -2468,6 +2472,10 @@ class SpecifyKeyPathRootType final : public ConstraintFix {
24682472
24692473 bool diagnose (const Solution &solution, bool asNote = false ) const override ;
24702474
2475+ bool diagnoseForAmbiguity (CommonFixesArray commonFixes) const override {
2476+ return diagnose (*commonFixes.front ().first );
2477+ }
2478+
24712479 static SpecifyKeyPathRootType *create (ConstraintSystem &cs,
24722480 ConstraintLocator *locator);
24732481
Original file line number Diff line number Diff line change @@ -1484,3 +1484,8 @@ func testUnwrapFixIts(x: Int?) throws {
14841484 // expected-note@-2 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}} {{42-42=!}}
14851485 let _: Int = try ! . optionalThrowsMember ?? 0
14861486}
1487+
1488+ func rdar86611718( list: [ Int ] ) {
1489+ String ( list. count ( ) )
1490+ // expected-error@-1 {{cannot call value of non-function type 'Int'}}
1491+ }
Original file line number Diff line number Diff line change @@ -188,3 +188,21 @@ func testSR13442() {
188188 _ = SR13442 ( \String ? .!. count) // OK
189189 let _: KeyPath < Int ? , Int > = \Optional .!
190190}
191+
192+ // rdar://85458997 - failed to produce a diagnostic about key path root type
193+ func rdar85458997( ) {
194+ struct S < R> {
195+ init ( _: KeyPath < R , String > ) {
196+ }
197+
198+ init ( _: KeyPath < R , Int > ) {
199+ }
200+ }
201+
202+ struct V {
203+ var name : String
204+ }
205+
206+ _ = S ( \. name)
207+ // expected-error@-1 {{cannot infer key path type from context; consider explicitly specifying a root type}} {{10-10=<#Root#>}}
208+ }
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ takesP1AndP2([Swift.DoesNotExist & P1 & P2]()) // expected-error {{module 'Swift
177177// expected-error@-1 {{binary operator '&' cannot be applied to operands of type 'UInt8' and 'P1.Protocol'}}
178178// expected-error@-2 {{binary operator '&' cannot be applied to operands of type 'UInt8' and 'P2.Protocol'}}
179179// expected-note@-3 2 {{overloads for '&' exist with these partially matching parameter lists}}
180-
180+ // expected-error@-4 {{cannot call value of non-function type '[UInt8]'}}
181181
182182typealias T08 = P1 & inout P2 // expected-error {{'inout' may only be used on parameters}}
183183typealias T09 = P1 & __shared P2 // expected-error {{'__shared' may only be used on parameters}}
You can’t perform that action at this time.
0 commit comments