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 @@ -14753,8 +14753,15 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
14753
14753
// means that result would attempt a type from each side if
14754
14754
// one is available and that would result in two fixes - one for
14755
14755
// each mismatched branch.
14756
- if (branchElt->forElse())
14756
+ if (branchElt->forElse()) {
14757
14757
impact = 10;
14758
+ } else {
14759
+ // Also increase impact for `then` branch lower than `else` to still
14760
+ // eliminate ambiguity, but slightly worst than the average fix to avoid
14761
+ // so the solution which record this fix wouldn't be picked over one
14762
+ // that has contextual mismatch fix on the result of ternary expression.
14763
+ impact = 5;
14764
+ }
14758
14765
}
14759
14766
using SingleValueStmtBranch = LocatorPathElt::SingleValueStmtBranch;
14760
14767
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