Skip to content

Commit ede9f33

Browse files
committed
Fix the fix
1 parent fe15d04 commit ede9f33

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3031,7 +3031,7 @@ class AsyncCallEmission final : public CallEmission {
30313031

30323032
if (nativeSchema.requiresIndirect() ||
30333033
errorSchema.shouldReturnTypedErrorIndirectly() ||
3034-
errorSchema.empty()) { // direct empty typed errors are passed
3034+
(errorSchema.empty() && fnConv.hasIndirectSILResults())) { // direct empty typed errors are passed
30353035
// indirectly for compatibility with generic
30363036
// functions.
30373037
// Return the error indirectly.

test/IRGen/typed_throws.sil

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,3 +489,30 @@ bb1(%12 : $()):
489489
bb2(%19 : $Never):
490490
unreachable
491491
}
492+
493+
sil @callee2 : $@convention(thin) @async (Int) -> (Int, @error Never) {
494+
bb0(%0 : $Int):
495+
%5 = integer_literal $Builtin.Int64, 66
496+
%6 = struct $Int (%5 : $Builtin.Int64)
497+
return %6 : $Int
498+
}
499+
500+
// CHECK: define{{.*}} swifttailcc void @callee2(ptr swiftasync %0, i64 %1)
501+
502+
// CHECK: define{{.*}} swifttailcc void @caller2(ptr swiftasync %0)
503+
// CHECK: [[CTXT:%.*]] = call swiftcc ptr @swift_task_alloc
504+
// CHECK: @llvm.coro.suspend.async.sl_p0i64p0s({{.*}} ptr @callee2, ptr [[CTXT]], i64 67)
505+
sil @caller2 : $@convention(thin) @async () -> () {
506+
bb0:
507+
%5 = integer_literal $Builtin.Int64, 67
508+
%6 = struct $Int (%5 : $Builtin.Int64)
509+
%10 = function_ref @callee2 : $@convention(thin) @async (Int) -> (Int, @error Never)
510+
try_apply %10(%6) : $@convention(thin) @async (Int) -> (Int, @error Never), normal bb1, error bb2
511+
512+
bb1(%12 : $Int):
513+
%17 = tuple ()
514+
return %17 : $()
515+
516+
bb2(%19 : $Never):
517+
unreachable
518+
}

0 commit comments

Comments
 (0)