mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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.
This commit is contained in:
@@ -6082,17 +6082,9 @@ private:
|
|||||||
OS << *ErrName << " " << tok::equal << " " << *ErrName << " ";
|
OS << *ErrName << " " << tok::equal << " " << *ErrName << " ";
|
||||||
OS << tok::l_brace << "\n";
|
OS << tok::l_brace << "\n";
|
||||||
for (auto Idx : indices(SuccessParamNames)) {
|
for (auto Idx : indices(SuccessParamNames)) {
|
||||||
auto &Name = SuccessParamNames[Idx];
|
|
||||||
auto ParamTy = SuccessParams[Idx].getParameterType();
|
auto ParamTy = SuccessParams[Idx].getParameterType();
|
||||||
if (!HandlerDesc.shouldUnwrap(ParamTy))
|
if (!HandlerDesc.shouldUnwrap(ParamTy))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// assert(res == nil, "Expected nil-success param 'res' for non-nil
|
|
||||||
// error")
|
|
||||||
OS << "assert" << tok::l_paren << Name << " == " << tok::kw_nil;
|
|
||||||
OS << tok::comma << " \"Expected nil success param '" << Name;
|
|
||||||
OS << "' for non-nil error\"";
|
|
||||||
OS << tok::r_paren << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// continuation.resume(throwing: err)
|
// continuation.resume(throwing: err)
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ func foo6(_ completion: @escaping (String?, Error?) -> Void) {}
|
|||||||
// FOO6-NEXT: return try await withCheckedThrowingContinuation { continuation in
|
// FOO6-NEXT: return try await withCheckedThrowingContinuation { continuation in
|
||||||
// FOO6-NEXT: foo6() { result, error in
|
// FOO6-NEXT: foo6() { result, error in
|
||||||
// FOO6-NEXT: if let error = error {
|
// FOO6-NEXT: if let error = error {
|
||||||
// FOO6-NEXT: assert(result == nil, "Expected nil success param 'result' for non-nil error")
|
|
||||||
// FOO6-NEXT: continuation.resume(throwing: error)
|
// FOO6-NEXT: continuation.resume(throwing: error)
|
||||||
// FOO6-NEXT: return
|
// FOO6-NEXT: return
|
||||||
// FOO6-NEXT: }
|
// FOO6-NEXT: }
|
||||||
@@ -104,7 +103,6 @@ func foo7(_ completion: @escaping (String?, Int, Error?) -> Void) {}
|
|||||||
// FOO7-NEXT: return try await withCheckedThrowingContinuation { continuation in
|
// FOO7-NEXT: return try await withCheckedThrowingContinuation { continuation in
|
||||||
// FOO7-NEXT: foo7() { result1, result2, error in
|
// FOO7-NEXT: foo7() { result1, result2, error in
|
||||||
// FOO7-NEXT: if let error = error {
|
// FOO7-NEXT: if let error = error {
|
||||||
// FOO7-NEXT: assert(result1 == nil, "Expected nil success param 'result1' for non-nil error")
|
|
||||||
// FOO7-NEXT: continuation.resume(throwing: error)
|
// FOO7-NEXT: continuation.resume(throwing: error)
|
||||||
// FOO7-NEXT: return
|
// FOO7-NEXT: return
|
||||||
// FOO7-NEXT: }
|
// FOO7-NEXT: }
|
||||||
@@ -123,8 +121,6 @@ func foo8(_ completion: @escaping (String?, Int?, Error?) -> Void) {}
|
|||||||
// FOO8-NEXT: return try await withCheckedThrowingContinuation { continuation in
|
// FOO8-NEXT: return try await withCheckedThrowingContinuation { continuation in
|
||||||
// FOO8-NEXT: foo8() { result1, result2, error in
|
// FOO8-NEXT: foo8() { result1, result2, error in
|
||||||
// FOO8-NEXT: if let error = error {
|
// FOO8-NEXT: if let error = error {
|
||||||
// FOO8-NEXT: assert(result1 == nil, "Expected nil success param 'result1' for non-nil error")
|
|
||||||
// FOO8-NEXT: assert(result2 == nil, "Expected nil success param 'result2' for non-nil error")
|
|
||||||
// FOO8-NEXT: continuation.resume(throwing: error)
|
// FOO8-NEXT: continuation.resume(throwing: error)
|
||||||
// FOO8-NEXT: return
|
// FOO8-NEXT: return
|
||||||
// FOO8-NEXT: }
|
// FOO8-NEXT: }
|
||||||
|
|||||||
Reference in New Issue
Block a user