@@ -6475,28 +6475,6 @@ bool FailureDiagnosis::diagnoseClosureExpr(
6475
6475
return false ;
6476
6476
}
6477
6477
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
-
6500
6478
// Ported version of TypeChecker::checkObjCKeyPathExpr which works
6501
6479
// with new Smart KeyPath feature.
6502
6480
static bool diagnoseKeyPathComponents (ConstraintSystem &CS, KeyPathExpr *KPE,
@@ -6728,18 +6706,13 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
6728
6706
corrections);
6729
6707
6730
6708
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 {
6740
6712
TC.diagnose (componentNameLoc, diag::use_unresolved_identifier,
6741
6713
componentName, false );
6742
-
6714
+ }
6715
+
6743
6716
// Note all the correction candidates.
6744
6717
corrections.noteAllCandidates ();
6745
6718
corrections.addAllCandidatesToLookup (lookup);
@@ -6851,9 +6824,6 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
6851
6824
}
6852
6825
6853
6826
bool FailureDiagnosis::visitKeyPathExpr (KeyPathExpr *KPE) {
6854
- if (diagnoseKeyPathUnsupportedOperations (CS.TC , KPE))
6855
- return true ;
6856
-
6857
6827
auto contextualType = CS.getContextualType ();
6858
6828
6859
6829
auto components = KPE->getComponents ();
0 commit comments