diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 34d698a068a..fd14748a48e 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -4571,7 +4571,8 @@ struct CallbackCondition { /// } /// ``` CallbackCondition(const Decl *Subject, const CaseLabelItem *CaseItem) { - if (auto *EEP = dyn_cast(CaseItem->getPattern())) { + if (auto *EEP = dyn_cast( + CaseItem->getPattern()->getSemanticsProvidingPattern())) { // `case .(let )` initFromEnumPattern(Subject, EEP); } diff --git a/test/refactoring/ConvertAsync/convert_pattern.swift b/test/refactoring/ConvertAsync/convert_pattern.swift index 83eae3b7936..b14872233f4 100644 --- a/test/refactoring/ConvertAsync/convert_pattern.swift +++ b/test/refactoring/ConvertAsync/convert_pattern.swift @@ -265,6 +265,16 @@ func testPatterns() async throws { // STRING-TUPLE-RESULT-NEXT: print("oh no") // STRING-TUPLE-RESULT-NEXT: } + // RUN: %refactor-check-compiles -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=STRING-TUPLE-RESULT %s + stringTupleResult { res in + switch res { + case let .success((x, y)): + print(x, y) + case .failure: + print("oh no") + } + } + // RUN: %refactor-check-compiles -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=MIXED-TUPLE-RESULT %s mixedTupleResult { res in if case .failure(let err) = res {