Skip to content

Commit 505c950

Browse files
committed
IRGen: Make sure loadable error types are mapped into the generic environment too
Fixes #77297 Fixes rdar://problem/139000360
1 parent 1acb61d commit 505c950

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,7 @@ static void emitEntryPointArgumentsNativeCC(IRGenSILFunction &IGF,
21912191
bool isIndirectError = fnConv.hasIndirectSILErrorResults();
21922192

21932193
if (isTypedError && !isIndirectError) {
2194-
auto &errorTI = cast<FixedTypeInfo>(IGF.getTypeInfo(errorType));
2194+
auto &errorTI = cast<FixedTypeInfo>(IGF.getTypeInfo(inContextErrorType));
21952195
IGF.setCallerTypedErrorResultSlot(Address(
21962196
emission->getCallerTypedErrorResultArgument(),
21972197
errorTI.getStorageType(),

test/IRGen/typed_throws.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,8 @@ func testit() throws (S) {
9191
public struct TypeH {
9292
public var method: (Int) throws(MyBigError) -> String
9393
}
94+
95+
// Used to crash with null GenericSignature -- https://github.com/swiftlang/swift/issues/77297
96+
struct LoadableGeneric<E>: Error {}
97+
98+
func throwsLoadableGeneric<E>(_: E) throws(LoadableGeneric<E>) {}

0 commit comments

Comments
 (0)