Skip to content

Commit b7acd12

Browse files
authored
Merge pull request #83074 from drexin/wip-155641749
[6.2][IRGen] Set generic context before getting call emission in visitFull…
2 parents 315de8d + 4a8ada3 commit b7acd12

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3850,6 +3850,10 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) {
38503850
}
38513851
}
38523852

3853+
// Lower the arguments and return value in the callee's generic context.
3854+
GenericContextScope scope(IGM,
3855+
origCalleeType->getInvocationGenericSignature());
3856+
38533857
Explosion llArgs;
38543858
WitnessMetadata witnessMetadata;
38553859
auto emission = getCallEmissionForLoweredValue(
@@ -3862,9 +3866,6 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) {
38623866

38633867
emission->begin();
38643868

3865-
// Lower the arguments and return value in the callee's generic context.
3866-
GenericContextScope scope(IGM, origCalleeType->getInvocationGenericSignature());
3867-
38683869
auto &calleeFP = emission->getCallee().getFunctionPointer();
38693870

38703871
// Allocate space for the coroutine buffer.

test/IRGen/typed_throws.swift

Lines changed: 12 additions & 0 deletions
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)