File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -14778,8 +14778,15 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
14778
14778
// means that result would attempt a type from each side if
14779
14779
// one is available and that would result in two fixes - one for
14780
14780
// each mismatched branch.
14781
- if (branchElt->forElse())
14781
+ if (branchElt->forElse()) {
14782
14782
impact = 10;
14783
+ } else {
14784
+ // Also increase impact for `then` branch lower than `else` to still
14785
+ // eliminate ambiguity, but slightly worst than the average fix to avoid
14786
+ // so the solution which record this fix wouldn't be picked over one
14787
+ // that has contextual mismatch fix on the result of ternary expression.
14788
+ impact = 5;
14789
+ }
14783
14790
}
14784
14791
using SingleValueStmtBranch = LocatorPathElt::SingleValueStmtBranch;
14785
14792
if (auto branchElt = locator->getLastElementAs<SingleValueStmtBranch>()) {
Original file line number Diff line number Diff line change @@ -951,3 +951,7 @@ let _ = "foo \(42 /*
951
951
// expected-error @-3 {{cannot find ')' to match opening '(' in string interpolation}} expected-error @-3 {{unterminated string literal}}
952
952
// expected-error @-2 {{expected expression}}
953
953
// expected-error @-3 {{unterminated string literal}}
954
+
955
+ // https://github.com/apple/swift/issues/66192
956
+ func I66192 ( _: Int) { }
957
+ I66192( true ? " yes " : " no " ) // expected-error{{cannot convert value of type 'String' to expected argument type 'Int'}}
You can’t perform that action at this time.
0 commit comments