private PythonType ValidateInheritedType(PythonType currentType, PythonType inheritedType) { if (inheritedType.IsNamedTypeParameter) { return(inheritedType); } // Python classes can't reference themselves or any of their parent classes in their inherited types if (currentType.GetBaseName() == inheritedType.GetBaseName() && currentType.Namespace == inheritedType.Namespace) { return(ToAnyAlias(inheritedType)); } inheritedType.TypeParameters = inheritedType.TypeParameters .Select(type => ValidateInheritedType(currentType, type)) .ToList(); return(inheritedType); }