diff --git a/stdlib/public/Reflection/TypeRef.cpp b/stdlib/public/Reflection/TypeRef.cpp index ad7cc1d74a7dd..cf94dc32acc89 100644 --- a/stdlib/public/Reflection/TypeRef.cpp +++ b/stdlib/public/Reflection/TypeRef.cpp @@ -728,11 +728,15 @@ bool TypeRef::isConcreteAfterSubstitutions( unsigned NominalTypeTrait::getDepth() const { if (auto P = Parent) { - if (auto *Nominal = dyn_cast(P)) - return 1 + Nominal->getDepth(); - return 1 + cast(P)->getDepth(); + switch (P->getKind()) { + case TypeRefKind::Nominal: + return 1 + cast(P)->getDepth(); + case TypeRefKind::BoundGeneric: + return 1 + cast(P)->getDepth(); + default: + break; + } } - return 0; }