@@ -1967,14 +1967,11 @@ lowerCaptureContextParameters(TypeConverter &TC, SILDeclRef function,
19671967 auto mapTypeOutOfContext = [&](Type t) -> CanType {
19681968 LLVM_DEBUG (llvm::dbgs () << " -- capture with contextual type " << t << " \n " );
19691969
1970- t = t.subst (MapLocalArchetypesOutOfContext (origGenericSig, capturedEnvs),
1971- MakeAbstractConformanceForGenericType (),
1972- SubstFlags::PreservePackExpansionLevel |
1973- SubstFlags::SubstitutePrimaryArchetypes |
1974- SubstFlags::SubstituteLocalArchetypes);
1975-
1976- LLVM_DEBUG (llvm::dbgs () << " -- maps to " << t->getCanonicalType () << " \n " );
1977- return t->getCanonicalType ();
1970+ auto result = mapLocalArchetypesOutOfContext (t, origGenericSig, capturedEnvs)
1971+ ->getCanonicalType ();
1972+
1973+ LLVM_DEBUG (llvm::dbgs () << " -- maps to " << result << " \n " );
1974+ return result;
19781975 };
19791976
19801977 for (auto capture : loweredCaptures.getCaptures ()) {
@@ -3004,26 +3001,17 @@ CanSILFunctionType swift::buildSILFunctionThunkType(
30043001 interfaceSubs);
30053002 }
30063003
3007- MapLocalArchetypesOutOfContext mapOutOfContext (baseGenericSig, capturedEnvs);
30083004 auto substFormalTypeIntoThunkContext =
30093005 [&](CanType t) -> CanType {
30103006 return genericEnv->mapTypeIntoContext (
3011- t.subst (mapOutOfContext,
3012- MakeAbstractConformanceForGenericType (),
3013- SubstFlags::PreservePackExpansionLevel |
3014- SubstFlags::SubstitutePrimaryArchetypes |
3015- SubstFlags::SubstituteLocalArchetypes))
3007+ mapLocalArchetypesOutOfContext (t, baseGenericSig, capturedEnvs))
30163008 ->getCanonicalType ();
30173009 };
30183010 auto substLoweredTypeIntoThunkContext =
30193011 [&](CanSILFunctionType t) -> CanSILFunctionType {
30203012 return cast<SILFunctionType>(
30213013 genericEnv->mapTypeIntoContext (
3022- Type (t).subst (mapOutOfContext,
3023- MakeAbstractConformanceForGenericType (),
3024- SubstFlags::PreservePackExpansionLevel |
3025- SubstFlags::SubstitutePrimaryArchetypes |
3026- SubstFlags::SubstituteLocalArchetypes))
3014+ mapLocalArchetypesOutOfContext (t, baseGenericSig, capturedEnvs))
30273015 ->getCanonicalType ());
30283016 };
30293017
0 commit comments