File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2989,7 +2989,14 @@ bool TupleContextualFailure::diagnoseAsError() {
2989
2989
diagnostic = diag::tuple_types_not_convertible_nelts;
2990
2990
else if ((purpose == CTP_Initialization) && !getContextualType (getAnchor ()))
2991
2991
diagnostic = diag::tuple_types_not_convertible;
2992
- else if (auto diag = getDiagnosticFor (purpose, getToType ()))
2992
+ else if (purpose == CTP_AssignSource) {
2993
+ auto assignExpr = castToExpr<AssignExpr>(getAnchor ());
2994
+ if (isa<SubscriptExpr>(assignExpr->getDest ())) {
2995
+ diagnostic = *getDiagnosticFor (CTP_SubscriptAssignSource, getToType ());
2996
+ } else {
2997
+ diagnostic = *getDiagnosticFor (purpose, getToType ());
2998
+ }
2999
+ } else if (auto diag = getDiagnosticFor (purpose, getToType ()))
2993
3000
diagnostic = *diag;
2994
3001
else
2995
3002
return false ;
You can’t perform that action at this time.
0 commit comments