Skip to content

Commit 91f0ca2

Browse files
technicatedToma91
authored andcommitted
Removed some now-unnecessary diagnostic / check
unsupported_keypath_tuple_element_reference expr_keypath_unimplemented_tuple
1 parent 1577afe commit 91f0ca2

File tree

2 files changed

+5
-39
lines changed

2 files changed

+5
-39
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,6 @@ ERROR(expr_swift_keypath_empty, none,
508508
"key path must have at least one component", ())
509509
ERROR(expr_string_interpolation_outside_string,none,
510510
"string interpolation can only appear inside a string literal", ())
511-
ERROR(unsupported_keypath_tuple_element_reference,none,
512-
"key path cannot reference tuple elements", ())
513-
ERROR(expr_keypath_unimplemented_tuple,none,
514-
"key path support for tuples is not implemented", ())
515511
ERROR(expr_keypath_subscript_index_not_hashable, none,
516512
"subscript index of type %0 in a key path must be Hashable", (Type))
517513
ERROR(expr_smart_keypath_application_type_mismatch,none,

lib/Sema/CSDiag.cpp

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6475,28 +6475,6 @@ bool FailureDiagnosis::diagnoseClosureExpr(
64756475
return false;
64766476
}
64776477

6478-
static bool diagnoseKeyPathUnsupportedOperations(TypeChecker &TC,
6479-
KeyPathExpr *KPE) {
6480-
if (KPE->isObjC())
6481-
return false;
6482-
6483-
using ComponentKind = KeyPathExpr::Component::Kind;
6484-
const auto components = KPE->getComponents();
6485-
6486-
if (auto *rootType = KPE->getRootType()) {
6487-
if (isa<TupleTypeRepr>(rootType)) {
6488-
auto first = components.front();
6489-
if (first.getKind() == ComponentKind::UnresolvedProperty) {
6490-
TC.diagnose(first.getLoc(),
6491-
diag::unsupported_keypath_tuple_element_reference);
6492-
return true;
6493-
}
6494-
}
6495-
}
6496-
6497-
return false;
6498-
}
6499-
65006478
// Ported version of TypeChecker::checkObjCKeyPathExpr which works
65016479
// with new Smart KeyPath feature.
65026480
static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
@@ -6728,18 +6706,13 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
67286706
corrections);
67296707

67306708
if (currentType) {
6731-
if (currentType->is<TupleType>()) {
6732-
TC.diagnose(KPE->getLoc(), diag::expr_keypath_unimplemented_tuple);
6733-
isInvalid = true;
6734-
break;
6735-
}
6736-
else
6737-
TC.diagnose(componentNameLoc, diag::could_not_find_type_member,
6738-
currentType, componentName);
6739-
} else
6709+
TC.diagnose(componentNameLoc, diag::could_not_find_type_member,
6710+
currentType, componentName);
6711+
} else {
67406712
TC.diagnose(componentNameLoc, diag::use_unresolved_identifier,
67416713
componentName, false);
6742-
6714+
}
6715+
67436716
// Note all the correction candidates.
67446717
corrections.noteAllCandidates();
67456718
corrections.addAllCandidatesToLookup(lookup);
@@ -6851,9 +6824,6 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
68516824
}
68526825

68536826
bool FailureDiagnosis::visitKeyPathExpr(KeyPathExpr *KPE) {
6854-
if (diagnoseKeyPathUnsupportedOperations(CS.TC, KPE))
6855-
return true;
6856-
68576827
auto contextualType = CS.getContextualType();
68586828

68596829
auto components = KPE->getComponents();

0 commit comments

Comments
 (0)