Skip to content

Commit 06219cd

Browse files
committed
[Async Refactoring] Remove assertions for nil result values in async wrapper
Since we aren’t checking that all result arguments are `nil` if there was an `error` in all the other refactorings, also remove the assertions in the async wrapper.
1 parent 6cbbb7c commit 06219cd

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

lib/IDE/Refactoring.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6082,17 +6082,9 @@ class AsyncConverter : private SourceEntityWalker {
60826082
OS << *ErrName << " " << tok::equal << " " << *ErrName << " ";
60836083
OS << tok::l_brace << "\n";
60846084
for (auto Idx : indices(SuccessParamNames)) {
6085-
auto &Name = SuccessParamNames[Idx];
60866085
auto ParamTy = SuccessParams[Idx].getParameterType();
60876086
if (!HandlerDesc.shouldUnwrap(ParamTy))
60886087
continue;
6089-
6090-
// assert(res == nil, "Expected nil-success param 'res' for non-nil
6091-
// error")
6092-
OS << "assert" << tok::l_paren << Name << " == " << tok::kw_nil;
6093-
OS << tok::comma << " \"Expected nil success param '" << Name;
6094-
OS << "' for non-nil error\"";
6095-
OS << tok::r_paren << "\n";
60966088
}
60976089

60986090
// continuation.resume(throwing: err)

test/refactoring/ConvertAsync/convert_async_wrapper.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ func foo6(_ completion: @escaping (String?, Error?) -> Void) {}
8585
// FOO6-NEXT: return try await withCheckedThrowingContinuation { continuation in
8686
// FOO6-NEXT: foo6() { result, error in
8787
// FOO6-NEXT: if let error = error {
88-
// FOO6-NEXT: assert(result == nil, "Expected nil success param 'result' for non-nil error")
8988
// FOO6-NEXT: continuation.resume(throwing: error)
9089
// FOO6-NEXT: return
9190
// FOO6-NEXT: }
@@ -104,7 +103,6 @@ func foo7(_ completion: @escaping (String?, Int, Error?) -> Void) {}
104103
// FOO7-NEXT: return try await withCheckedThrowingContinuation { continuation in
105104
// FOO7-NEXT: foo7() { result1, result2, error in
106105
// FOO7-NEXT: if let error = error {
107-
// FOO7-NEXT: assert(result1 == nil, "Expected nil success param 'result1' for non-nil error")
108106
// FOO7-NEXT: continuation.resume(throwing: error)
109107
// FOO7-NEXT: return
110108
// FOO7-NEXT: }
@@ -123,8 +121,6 @@ func foo8(_ completion: @escaping (String?, Int?, Error?) -> Void) {}
123121
// FOO8-NEXT: return try await withCheckedThrowingContinuation { continuation in
124122
// FOO8-NEXT: foo8() { result1, result2, error in
125123
// FOO8-NEXT: if let error = error {
126-
// FOO8-NEXT: assert(result1 == nil, "Expected nil success param 'result1' for non-nil error")
127-
// FOO8-NEXT: assert(result2 == nil, "Expected nil success param 'result2' for non-nil error")
128124
// FOO8-NEXT: continuation.resume(throwing: error)
129125
// FOO8-NEXT: return
130126
// FOO8-NEXT: }

0 commit comments

Comments
 (0)