mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Diagnostics: Ported tuple mismatch diagnostic to new diagnostic framework
This commit is contained in:
@@ -1147,9 +1147,9 @@ bool FailureDiagnosis::diagnoseGeneralConversionFailure(Constraint *constraint){
|
||||
if (auto fromTT = fromType->getAs<TupleType>())
|
||||
if (auto toTT = toType->getAs<TupleType>()) {
|
||||
if (fromTT->getNumElements() != toTT->getNumElements()) {
|
||||
diagnose(anchor->getLoc(), diag::tuple_types_not_convertible_nelts,
|
||||
fromTT, toTT)
|
||||
.highlight(anchor->getSourceRange());
|
||||
auto failure = TupleContextualFailure(anchor, CS, fromTT, toTT,
|
||||
CS.getConstraintLocator(expr));
|
||||
failure.diagnoseAsError();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1166,9 +1166,9 @@ bool FailureDiagnosis::diagnoseGeneralConversionFailure(Constraint *constraint){
|
||||
// then we have a type error.
|
||||
if (computeTupleShuffle(TEType->castTo<TupleType>()->getElements(),
|
||||
toTT->getElements(), sources)) {
|
||||
diagnose(anchor->getLoc(), diag::tuple_types_not_convertible,
|
||||
fromTT, toTT)
|
||||
.highlight(anchor->getSourceRange());
|
||||
auto failure = TupleContextualFailure(anchor, CS, fromTT, toTT,
|
||||
CS.getConstraintLocator(expr));
|
||||
failure.diagnoseAsError();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user