File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1205,6 +1205,10 @@ class RemoveUnwrap final : public ConstraintFix {
12051205
12061206 bool diagnose (const Solution &solution, bool asNote = false ) const override ;
12071207
1208+ bool diagnoseForAmbiguity (CommonFixesArray commonFixes) const override {
1209+ return diagnose (*commonFixes.front ().first );
1210+ }
1211+
12081212 static RemoveUnwrap *create (ConstraintSystem &cs, Type baseType,
12091213 ConstraintLocator *locator);
12101214
Original file line number Diff line number Diff line change @@ -588,4 +588,14 @@ do {
588588 takesP ( value)
589589 // expected-error@-1 {{argument type '(any BinaryInteger)?' does not conform to expected type 'P'}}
590590 }
591- }
591+ }
592+
593+ // Diagnose extraneous force unwrap in ambiguous context
594+ do {
595+ func test( _: Int ) { } // expected-note {{found this candidate}}
596+ func test( _: String ) { } // expected-note {{found this candidate}}
597+
598+ var x : Double = 42
599+ test ( x!) // expected-error {{no exact matches in call to local function 'test'}}
600+ // expected-error@-1 {{cannot force unwrap value of non-optional type 'Double'}}
601+ }
Original file line number Diff line number Diff line change 121121} // expected-error {{expected expression after operator}}
122122
123123_ = /x/ ??/ x/ // expected-error {{'/' is not a postfix unary operator}}
124+ // expected-error@-1 2 {{cannot use optional chaining on non-optional value of type 'Regex<Substring>'}}
124125
125126_ = /x/ ... /y/ // expected-error {{referencing operator function '...' on 'Comparable' requires that 'Regex<Substring>' conform to 'Comparable'}}
126127
You can’t perform that action at this time.
0 commit comments