mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Push ArchetypeType's API down to subclasses.
And clean up code that conditionally works only with certain kinds of archetype along the way.
This commit is contained in:
@@ -202,7 +202,7 @@ static ManagedValue emitTransformExistential(SILGenFunction &SGF,
|
||||
ArchetypeType *openedArchetype = nullptr;
|
||||
|
||||
if (inputType->isAnyExistentialType()) {
|
||||
CanType openedType = ArchetypeType::getAnyOpened(inputType);
|
||||
CanType openedType = OpenedArchetypeType::getAny(inputType);
|
||||
SILType loweredOpenedType = SGF.getLoweredType(openedType);
|
||||
|
||||
// Unwrap zero or more metatype levels
|
||||
@@ -575,7 +575,7 @@ ManagedValue Transform::transform(ManagedValue v,
|
||||
|
||||
auto layout = instanceType.getExistentialLayout();
|
||||
if (layout.explicitSuperclass) {
|
||||
CanType openedType = ArchetypeType::getAnyOpened(inputSubstType);
|
||||
CanType openedType = OpenedArchetypeType::getAny(inputSubstType);
|
||||
SILType loweredOpenedType = SGF.getLoweredType(openedType);
|
||||
|
||||
// Unwrap zero or more metatype levels
|
||||
@@ -2889,7 +2889,7 @@ static void buildThunkBody(SILGenFunction &SGF, SILLocation loc,
|
||||
static CanGenericSignature
|
||||
buildThunkSignature(SILGenFunction &SGF,
|
||||
bool inheritGenericSig,
|
||||
ArchetypeType *openedExistential,
|
||||
OpenedArchetypeType *openedExistential,
|
||||
GenericEnvironment *&genericEnv,
|
||||
SubstitutionMap &contextSubs,
|
||||
SubstitutionMap &interfaceSubs,
|
||||
@@ -2988,16 +2988,17 @@ CanSILFunctionType SILGenFunction::buildThunkType(
|
||||
// Does the thunk type involve archetypes other than opened existentials?
|
||||
bool hasArchetypes = false;
|
||||
// Does the thunk type involve an open existential type?
|
||||
CanArchetypeType openedExistential;
|
||||
CanOpenedArchetypeType openedExistential;
|
||||
auto archetypeVisitor = [&](CanType t) {
|
||||
if (auto archetypeTy = dyn_cast<ArchetypeType>(t)) {
|
||||
if (archetypeTy->getOpenedExistentialType()) {
|
||||
if (auto opened = dyn_cast<OpenedArchetypeType>(archetypeTy)) {
|
||||
assert((openedExistential == CanArchetypeType() ||
|
||||
openedExistential == archetypeTy) &&
|
||||
openedExistential == opened) &&
|
||||
"one too many open existentials");
|
||||
openedExistential = archetypeTy;
|
||||
} else
|
||||
openedExistential = opened;
|
||||
} else {
|
||||
hasArchetypes = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user