Skip to content

Commit 4c4e3b0

Browse files
authored
Merge pull request #61063 from slavapestov/sil-function-type-coroutine
SIL: Use the right generic signature for computing SIL function type for coroutine accessors
2 parents e8cba2c + e584195 commit 4c4e3b0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,9 +1960,12 @@ static CanSILFunctionType getSILFunctionType(
19601960

19611961
if (reqtSubs) {
19621962
valueType = valueType.subst(*reqtSubs);
1963+
coroutineSubstYieldType = valueType->getReducedType(
1964+
genericSig);
1965+
} else {
1966+
coroutineSubstYieldType = valueType->getReducedType(
1967+
accessor->getGenericSignature());
19631968
}
1964-
1965-
coroutineSubstYieldType = valueType->getReducedType(genericSig);
19661969
}
19671970

19681971
bool shouldBuildSubstFunctionType = [&]{

test/SILGen/constrained_extensions.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,16 @@ func referenceNestedTypes() {
227227
_ = Array<AnyObject>.NestedClass()
228228
_ = Array<AnyObject>.DerivedClass()
229229
}
230+
231+
struct S<T> {
232+
struct X {}
233+
}
234+
235+
// CHECK-LABEL: sil hidden [ossa] @$s22constrained_extensions1SVAASiRszlEyAC1XVySi_GSicir : $@yield_once @convention(method) (Int, S<Int>) -> @yields S<Int>.X
236+
extension S<Int> {
237+
subscript(index:Int) -> X {
238+
_read {
239+
fatalError()
240+
}
241+
}
242+
}

0 commit comments

Comments
 (0)