@@ -754,44 +754,48 @@ CheckRedeclarationRequest::evaluate(Evaluator &eval, ValueDecl *current) const {
754
754
declToDiagnose->diagnose (diag::invalid_redecl_implicit,
755
755
current->getDescriptiveKind (),
756
756
isProtocolRequirement, other->getName ());
757
- }
758
757
759
- // Emit a specialized note if the one of the declarations is
760
- // the backing storage property ('_foo') or projected value
761
- // property ('$foo') for a wrapped property. The backing or
762
- // projected var has the same source location as the wrapped
763
- // property we diagnosed above, so we don't need to extract
764
- // the original property.
765
- const VarDecl *varToDiagnose = nullptr ;
766
- auto kind = PropertyWrapperSynthesizedPropertyKind::Backing;
767
- if (auto currentVD = dyn_cast<VarDecl>(current)) {
768
- if (auto currentKind =
769
- currentVD->getPropertyWrapperSynthesizedPropertyKind ()) {
770
- varToDiagnose = currentVD;
771
- kind = *currentKind;
758
+ // Emit a specialized note if the one of the declarations is
759
+ // the backing storage property ('_foo') or projected value
760
+ // property ('$foo') for a wrapped property. The backing or
761
+ // projected var has the same source location as the wrapped
762
+ // property we diagnosed above, so we don't need to extract
763
+ // the original property.
764
+ const VarDecl *varToDiagnose = nullptr ;
765
+ auto kind = PropertyWrapperSynthesizedPropertyKind::Backing;
766
+ if (auto currentVD = dyn_cast<VarDecl>(current)) {
767
+ if (auto currentKind =
768
+ currentVD->getPropertyWrapperSynthesizedPropertyKind ()) {
769
+ varToDiagnose = currentVD;
770
+ kind = *currentKind;
771
+ }
772
772
}
773
- }
774
- if (auto otherVD = dyn_cast<VarDecl>(other)) {
775
- if (auto otherKind =
776
- otherVD->getPropertyWrapperSynthesizedPropertyKind ()) {
777
- varToDiagnose = otherVD;
778
- kind = *otherKind;
773
+ if (auto otherVD = dyn_cast<VarDecl>(other)) {
774
+ if (auto otherKind =
775
+ otherVD->getPropertyWrapperSynthesizedPropertyKind ()) {
776
+ varToDiagnose = otherVD;
777
+ kind = *otherKind;
778
+ }
779
+ }
780
+
781
+ if (varToDiagnose) {
782
+ assert (declToDiagnose);
783
+ varToDiagnose->diagnose (
784
+ diag::invalid_redecl_implicit_wrapper, varToDiagnose->getName (),
785
+ kind == PropertyWrapperSynthesizedPropertyKind::Backing);
779
786
}
780
- }
781
787
782
- if (varToDiagnose) {
783
- varToDiagnose->diagnose (
784
- diag::invalid_redecl_implicit_wrapper, varToDiagnose->getName (),
785
- kind == PropertyWrapperSynthesizedPropertyKind::Backing);
788
+ current->setInvalid ();
786
789
}
787
790
} else {
788
791
ctx.Diags .diagnoseWithNotes (
789
792
current->diagnose (diag::invalid_redecl,
790
793
current->getName ()), [&]() {
791
794
other->diagnose (diag::invalid_redecl_prev, other->getName ());
792
795
});
796
+
797
+ current->setInvalid ();
793
798
}
794
- current->setInvalid ();
795
799
}
796
800
797
801
// Make sure we don't do this checking again for the same decl. We also
0 commit comments