mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Tighten up invariants for createDesignatedInitOverride()
This commit is contained in:
@@ -539,6 +539,7 @@ SubstitutionMap::getOverrideSubstitutions(const ClassDecl *baseClass,
|
||||
auto derivedClassTy = derivedClass->getDeclaredInterfaceType();
|
||||
baseSubMap = derivedClassTy->getContextSubstitutionMap(
|
||||
baseClass->getParentModule(), baseClass);
|
||||
assert(!baseSubMap.hasArchetypes());
|
||||
}
|
||||
|
||||
unsigned origDepth = 0;
|
||||
|
||||
@@ -4835,8 +4835,10 @@ TypeBase::getContextSubstitutions(const DeclContext *dc,
|
||||
|
||||
// Find the superclass type with the context matching that of the member.
|
||||
auto *ownerNominal = dc->getSelfNominalTypeDecl();
|
||||
if (auto *ownerClass = dyn_cast<ClassDecl>(ownerNominal))
|
||||
baseTy = baseTy->getSuperclassForDecl(ownerClass);
|
||||
if (auto *ownerClass = dyn_cast<ClassDecl>(ownerNominal)) {
|
||||
baseTy = baseTy->getSuperclassForDecl(ownerClass,
|
||||
/*usesArchetypes=*/genericEnv != nullptr);
|
||||
}
|
||||
|
||||
// Gather all of the substitutions for all levels of generic arguments.
|
||||
auto params = genericSig.getGenericParams();
|
||||
|
||||
@@ -645,6 +645,8 @@ createDesignatedInitOverride(ClassDecl *classDecl,
|
||||
auto genericSig = ctx.getOverrideGenericSignature(
|
||||
superclassDecl, classDecl, superclassCtorSig, genericParams);
|
||||
|
||||
assert(!subMap.hasArchetypes());
|
||||
|
||||
if (superclassCtorSig) {
|
||||
auto *genericEnv = genericSig.getGenericEnvironment();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user