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 {
|
Type AbstractTypeParamDecl::getSuperclass() const {
|
||||||
auto *dc = getDeclContext();
|
auto *genericEnv = getDeclContext()->getGenericEnvironmentOfContext();
|
||||||
auto contextTy = dc->mapTypeIntoContext(getDeclaredInterfaceType());
|
assert(genericEnv != nullptr && "Too much circularity");
|
||||||
|
|
||||||
|
auto contextTy = genericEnv->mapTypeIntoContext(getDeclaredInterfaceType());
|
||||||
if (auto *archetype = contextTy->getAs<ArchetypeType>())
|
if (auto *archetype = contextTy->getAs<ArchetypeType>())
|
||||||
return archetype->getSuperclass();
|
return archetype->getSuperclass();
|
||||||
|
|
||||||
@@ -2327,8 +2329,10 @@ Type AbstractTypeParamDecl::getSuperclass() const {
|
|||||||
|
|
||||||
ArrayRef<ProtocolDecl *>
|
ArrayRef<ProtocolDecl *>
|
||||||
AbstractTypeParamDecl::getConformingProtocols() const {
|
AbstractTypeParamDecl::getConformingProtocols() const {
|
||||||
auto *dc = getDeclContext();
|
auto *genericEnv = getDeclContext()->getGenericEnvironmentOfContext();
|
||||||
auto contextTy = dc->mapTypeIntoContext(getDeclaredInterfaceType());
|
assert(genericEnv != nullptr && "Too much circularity");
|
||||||
|
|
||||||
|
auto contextTy = genericEnv->mapTypeIntoContext(getDeclaredInterfaceType());
|
||||||
if (auto *archetype = contextTy->getAs<ArchetypeType>())
|
if (auto *archetype = contextTy->getAs<ArchetypeType>())
|
||||||
return archetype->getConformsTo();
|
return archetype->getConformsTo();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user