Skip to content

Commit 3efa770

Browse files
authored
Merge pull request #77371 from slavapestov/fix-issue-77297
IRGen: Make sure loadable error types are mapped into the generic environment too
2 parents 6d76534 + 505c950 commit 3efa770

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/IRGen/IRGenSIL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2201,7 +2201,7 @@ static void emitEntryPointArgumentsNativeCC(IRGenSILFunction &IGF,
22012201
bool isIndirectError = fnConv.hasIndirectSILErrorResults();
22022202

22032203
if (isTypedError && !isIndirectError) {
2204-
auto &errorTI = cast<FixedTypeInfo>(IGF.getTypeInfo(errorType));
2204+
auto &errorTI = cast<FixedTypeInfo>(IGF.getTypeInfo(inContextErrorType));
22052205
IGF.setCallerTypedErrorResultSlot(Address(
22062206
emission->getCallerTypedErrorResultArgument(),
22072207
errorTI.getStorageType(),

test/IRGen/typed_throws.swift

+5
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)