Skip to content

Commit dd97862

Browse files
authored
Merge pull request #77965 from drexin/wip-140573912
[IRGen] Check if type is empty instead of void in CallEmission::emitT…
2 parents 41efe32 + 38e3678 commit dd97862

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4564,7 +4564,7 @@ void CallEmission::emitToUnmappedExplosionWithDirectTypedError(
45644564
}
45654565

45664566
// If the regular result type is void, there is nothing to explode
4567-
if (!resultType.isVoid()) {
4567+
if (!nativeSchema.empty()) {
45684568
Explosion resultExplosion;
45694569
if (auto *structTy =
45704570
dyn_cast<llvm::StructType>(nativeSchema.getExpandedType(IGF.IGM))) {

test/IRGen/typed_throws.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,16 @@ public func reabstractAsyncVoidThrowsNever() async {
252252
struct LoadableGeneric<E>: Error {}
253253

254254
func throwsLoadableGeneric<E>(_: E) throws(LoadableGeneric<E>) {}
255+
256+
@inline(never)
257+
func throwError() throws(SmallError) -> Never {
258+
throw SmallError(x: 1)
259+
}
260+
261+
func conditionallyCallsThrowError(b: Bool) throws(SmallError) -> Int {
262+
if b {
263+
try throwError()
264+
} else {
265+
return 0
266+
}
267+
}

0 commit comments

Comments
 (0)