mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Repent for my sins by adding new assertions
Since the previous fix is essentially a hack to dodge an assertion, I'm adding stronger assertions to AbstractTypeParamDecl::getSuperclass() and getConformingProtocols().
This commit is contained in:
@@ -2316,8 +2316,10 @@ UnboundGenericType *TypeAliasDecl::getUnboundGenericType() const {
|
||||
}
|
||||
|
||||
Type AbstractTypeParamDecl::getSuperclass() const {
|
||||
auto *dc = getDeclContext();
|
||||
auto contextTy = dc->mapTypeIntoContext(getDeclaredInterfaceType());
|
||||
auto *genericEnv = getDeclContext()->getGenericEnvironmentOfContext();
|
||||
assert(genericEnv != nullptr && "Too much circularity");
|
||||
|
||||
auto contextTy = genericEnv->mapTypeIntoContext(getDeclaredInterfaceType());
|
||||
if (auto *archetype = contextTy->getAs<ArchetypeType>())
|
||||
return archetype->getSuperclass();
|
||||
|
||||
@@ -2327,8 +2329,10 @@ Type AbstractTypeParamDecl::getSuperclass() const {
|
||||
|
||||
ArrayRef<ProtocolDecl *>
|
||||
AbstractTypeParamDecl::getConformingProtocols() const {
|
||||
auto *dc = getDeclContext();
|
||||
auto contextTy = dc->mapTypeIntoContext(getDeclaredInterfaceType());
|
||||
auto *genericEnv = getDeclContext()->getGenericEnvironmentOfContext();
|
||||
assert(genericEnv != nullptr && "Too much circularity");
|
||||
|
||||
auto contextTy = genericEnv->mapTypeIntoContext(getDeclaredInterfaceType());
|
||||
if (auto *archetype = contextTy->getAs<ArchetypeType>())
|
||||
return archetype->getConformsTo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user