We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
instead of
1 parent 07865c7 commit 83744d9Copy full SHA for 83744d9
lib/Sema/CSDiagnostics.cpp
@@ -671,10 +671,11 @@ bool GenericArgumentsMismatchFailure::diagnoseAsError() {
671
}
672
673
case ConstraintLocator::TupleElement: {
674
- if (auto *array = dyn_cast<ArrayExpr>(getRawAnchor()))
675
- diagnostic = getDiagnosticFor(CTP_ArrayElement);
+ auto *anchor = getRawAnchor();
676
677
- if (auto *dict = dyn_cast<DictionaryExpr>(getRawAnchor())) {
+ if (isa<ArrayExpr>(anchor)) {
+ diagnostic = getDiagnosticFor(CTP_ArrayElement);
678
+ } else if (isa<DictionaryExpr>(anchor)) {
679
auto eltLoc = last.castTo<LocatorPathElt::TupleElement>();
680
diagnostic = getDiagnosticFor(
681
eltLoc.getIndex() == 0 ? CTP_DictionaryKey : CTP_DictionaryValue);
0 commit comments