Fix unsafeGetSubstFieldType to propagate a substitution map in

whichever case it happens to be in.

This is a basic fix so that parallel walks on tuples and function
types in the substituted type will work .  Separately, though, I
do not think the places that use this really need to be passed an
orig type; this is used for computing type properties, and I am
not aware of any reason we should need an orig type to compute
type properties.  Additionally, the orig types computed by this
function are not really correct because of the substitution being
done in some cases, so it'd be very nice to rip this all out.
I'm not good to look into that right now, though.
This commit is contained in:
John McCall
2023-03-22 01:45:27 -04:00
parent bbc682822a
commit f99efc2f94
3 changed files with 15 additions and 8 deletions

View File

@@ -1583,13 +1583,14 @@ bool AbstractionPattern::hasSameBasicTypeStructure(CanType l, CanType r) {
AbstractionPattern
AbstractionPattern::unsafeGetSubstFieldType(ValueDecl *member,
CanType origMemberInterfaceType)
CanType origMemberInterfaceType,
SubstitutionMap subMap)
const {
assert(origMemberInterfaceType);
if (isTypeParameterOrOpaqueArchetype()) {
// Fall back to the generic abstraction pattern for the member.
auto sig = member->getDeclContext()->getGenericSignatureOfContext();
return AbstractionPattern(sig.getCanonicalSignature(),
return AbstractionPattern(subMap, sig.getCanonicalSignature(),
origMemberInterfaceType);
}
@@ -1626,7 +1627,9 @@ const {
member, origMemberInterfaceType)
->getReducedType(getGenericSignature());
return AbstractionPattern(getGenericSignature(), memberTy);
return AbstractionPattern(getGenericSubstitutions(),
getGenericSignature(),
memberTy);
}
llvm_unreachable("invalid abstraction pattern kind");
}