Skip to content

Commit cf2e7f6

Browse files
committed
Fix SR-718: Type mismatch reported as extraneous parameter
The issue here is that the constraint solver was deciding on FixKind::RelabelCallTuple as the fix for the problem and emitting the diagnostic, even though there were two different fixes possible. CSDiags has the infrastructure to support doing doing the right thing here, but is only being used for ApplyExprs, not SubscriptExprs. The solution is to fix both problems: remove FixKind::RelabelCallTuple, to let CSDiags handle the problem, and enhance CSDiags to treat SubscriptExpr more commonly with ApplyExpr. This improves several cases where the solver was picking one solution randomly and suggesting that as a fix, instead of listing that there are multiple different solutions.
1 parent df62c78 commit cf2e7f6

14 files changed

+297
-303
lines changed

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6182,7 +6182,6 @@ bool ConstraintSystem::applySolutionFix(Expr *expr,
61826182

61836183
case FixKind::TupleToScalar:
61846184
case FixKind::ScalarToTuple:
6185-
case FixKind::RelabelCallTuple:
61866185
return diagnoseArgumentLabelError(affected,
61876186
fix.first.getRelabelTupleNames(*this),
61886187
/*isSubscript=*/locator->getPath().back().getKind()

0 commit comments

Comments
 (0)