================ @@ -3143,15 +3144,51 @@ def isKindResultType(self) -> bool: class CompletionString(ClangObject): - class Availability: - def __init__(self, name): - self.name = name + # AvailabilityKindCompat is an exact copy of AvailabilityKind, except for __str__. + # This is a temporary measure to keep the string representation the same + # until we change CompletionString.availability to return AvailabilityKind, + # like Cursor.availability does. + # Note that deriving from AvailabilityKind directly is not possible. + class AvailabilityKindCompat(BaseEnumeration): + """ + Describes the availability of an entity. + It is deprecated in favor of AvailabilityKind. + """ - def __str__(self): - return self.name + # Ensure AvailabilityKindCompat is comparable with AvailabilityKind + def __eq__(self, other: object) -> bool: + if isinstance( + other, (AvailabilityKind, CompletionString.AvailabilityKindCompat) ---------------- DeinAlptraum wrote:
You can shorten name lookups via module imports, but namespaces under classes work differently and always need to be fully qualified (speaking from intutition, not that I can cite documentation here). I've also confirmed that removing the `CompletionString.` here leads to an error. The only thing one could do, is to refer to it via `self.__class__` or similar instead, but that's hard to read imo. https://github.com/llvm/llvm-project/pull/160296 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
