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