@@ -1988,6 +1988,7 @@ static void destructureYieldsForCoroutine(TypeConverter &TC,
1988
1988
Optional<SILDeclRef> origConstant,
1989
1989
Optional<SILDeclRef> constant,
1990
1990
Optional<SubstitutionMap> reqtSubs,
1991
+ Optional<GenericSignature> genericSig,
1991
1992
SmallVectorImpl<SILYieldInfo> &yields,
1992
1993
SILCoroutineKind &coroutineKind,
1993
1994
SubstFunctionTypeCollector &subst) {
@@ -2012,12 +2013,14 @@ static void destructureYieldsForCoroutine(TypeConverter &TC,
2012
2013
2013
2014
auto storage = accessor->getStorage ();
2014
2015
auto valueType = storage->getValueInterfaceType ();
2016
+
2015
2017
if (reqtSubs) {
2016
2018
valueType = valueType.subst (*reqtSubs);
2017
2019
}
2018
2020
2019
- auto canValueType = valueType->getCanonicalType (
2020
- accessor->getGenericSignature ());
2021
+ auto canValueType = (genericSig
2022
+ ? valueType->getCanonicalType (*genericSig)
2023
+ : valueType->getCanonicalType ());
2021
2024
2022
2025
// 'modify' yields an inout of the target type.
2023
2026
if (accessor->getAccessorKind () == AccessorKind::Modify) {
@@ -2178,7 +2181,8 @@ static CanSILFunctionType getSILFunctionType(
2178
2181
SILCoroutineKind coroutineKind = SILCoroutineKind::None;
2179
2182
SmallVector<SILYieldInfo, 8 > yields;
2180
2183
destructureYieldsForCoroutine (TC, expansionContext, origConstant, constant,
2181
- reqtSubs, yields, coroutineKind, subst);
2184
+ reqtSubs, genericSig, yields, coroutineKind,
2185
+ subst);
2182
2186
2183
2187
// Destructure the result tuple type.
2184
2188
SmallVector<SILResultInfo, 8 > results;
0 commit comments