[Refactoring] Support refactoring for case let patterns

Previously we only supported `case` patterns that bound with a `let` inside the associated value like `case .success(let value)`. With this change, we also support `case let .success(value)`.

Fixes rdar://79279846 [SR-14772]
This commit is contained in:
Alex Hoppen
2021-06-14 12:29:08 +02:00
parent 38a8b008bc
commit 81b37fdb4c
2 changed files with 12 additions and 1 deletions

View File

@@ -4571,7 +4571,8 @@ struct CallbackCondition {
/// }
/// ```
CallbackCondition(const Decl *Subject, const CaseLabelItem *CaseItem) {
if (auto *EEP = dyn_cast<EnumElementPattern>(CaseItem->getPattern())) {
if (auto *EEP = dyn_cast<EnumElementPattern>(
CaseItem->getPattern()->getSemanticsProvidingPattern())) {
// `case .<func>(let <bind>)`
initFromEnumPattern(Subject, EEP);
}