Skip to content

Commit 4b7edce

Browse files
authored
Merge pull request #80746 from drexin/wip-149007227
[IRGen] Set generic context before getting call emission in visitFull…
2 parents ae1f9d9 + e9062b2 commit 4b7edce

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/IRGen/IRGenSIL.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -3861,6 +3861,10 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) {
38613861
}
38623862
}
38633863

3864+
// Lower the arguments and return value in the callee's generic context.
3865+
GenericContextScope scope(IGM,
3866+
origCalleeType->getInvocationGenericSignature());
3867+
38643868
Explosion llArgs;
38653869
WitnessMetadata witnessMetadata;
38663870
auto emission = getCallEmissionForLoweredValue(
@@ -3873,9 +3877,6 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) {
38733877

38743878
emission->begin();
38753879

3876-
// Lower the arguments and return value in the callee's generic context.
3877-
GenericContextScope scope(IGM, origCalleeType->getInvocationGenericSignature());
3878-
38793880
auto &calleeFP = emission->getCallee().getFunctionPointer();
38803881

38813882
// Allocate space for the coroutine buffer.

test/IRGen/typed_throws.swift

+12
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,15 @@ struct SomeStruct {
359359
func someFunc() async throws(SmallError) -> SomeStruct {
360360
SomeStruct(x: 42, y: 23, z: 25)
361361
}
362+
363+
// Used to crash the compiler -- https://github.com/swiftlang/swift/issues/80732
364+
protocol PAssoc<T>: AnyObject {
365+
associatedtype T
366+
func foo() async throws(SmallError) -> (any PAssoc<T>)
367+
}
368+
369+
class MyProtocolImpl<T>: PAssoc {
370+
func foo() async throws(SmallError) -> (any PAssoc<T>) {
371+
fatalError()
372+
}
373+
}

0 commit comments

Comments
 (0)