Skip to content

Commit 5ee57ed

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 583c5ca commit 5ee57ed

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
@@ -6094,17 +6094,9 @@ class AsyncConverter : private SourceEntityWalker {
60946094
OS << *ErrName << " " << tok::equal << " " << *ErrName << " ";
60956095
OS << tok::l_brace << "\n";
60966096
for (auto Idx : indices(SuccessParamNames)) {
6097-
auto &Name = SuccessParamNames[Idx];
60986097
auto ParamTy = SuccessParams[Idx].getParameterType();
60996098
if (!HandlerDesc.shouldUnwrap(ParamTy))
61006099
continue;
6101-
6102-
// assert(res == nil, "Expected nil-success param 'res' for non-nil
6103-
// error")
6104-
OS << "assert" << tok::l_paren << Name << " == " << tok::kw_nil;
6105-
OS << tok::comma << " \"Expected nil success param '" << Name;
6106-
OS << "' for non-nil error\"";
6107-
OS << tok::r_paren << "\n";
61086100
}
61096101

61106102
// 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)