@@ -1988,6 +1988,7 @@ static void destructureYieldsForCoroutine(TypeConverter &TC,
19881988 Optional<SILDeclRef> origConstant,
19891989 Optional<SILDeclRef> constant,
19901990 Optional<SubstitutionMap> reqtSubs,
1991+ Optional<GenericSignature> genericSig,
19911992 SmallVectorImpl<SILYieldInfo> &yields,
19921993 SILCoroutineKind &coroutineKind,
19931994 SubstFunctionTypeCollector &subst) {
@@ -2012,12 +2013,14 @@ static void destructureYieldsForCoroutine(TypeConverter &TC,
20122013
20132014 auto storage = accessor->getStorage ();
20142015 auto valueType = storage->getValueInterfaceType ();
2016+
20152017 if (reqtSubs) {
20162018 valueType = valueType.subst (*reqtSubs);
20172019 }
20182020
2019- auto canValueType = valueType->getCanonicalType (
2020- accessor->getGenericSignature ());
2021+ auto canValueType = (genericSig
2022+ ? valueType->getCanonicalType (*genericSig)
2023+ : valueType->getCanonicalType ());
20212024
20222025 // 'modify' yields an inout of the target type.
20232026 if (accessor->getAccessorKind () == AccessorKind::Modify) {
@@ -2178,7 +2181,8 @@ static CanSILFunctionType getSILFunctionType(
21782181 SILCoroutineKind coroutineKind = SILCoroutineKind::None;
21792182 SmallVector<SILYieldInfo, 8 > yields;
21802183 destructureYieldsForCoroutine (TC, expansionContext, origConstant, constant,
2181- reqtSubs, yields, coroutineKind, subst);
2184+ reqtSubs, genericSig, yields, coroutineKind,
2185+ subst);
21822186
21832187 // Destructure the result tuple type.
21842188 SmallVector<SILResultInfo, 8 > results;
0 commit comments