================ @@ -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) ---------------- Endilll wrote:
At first I thought that we don't need to qualify `AvailabilityKindCompat` with `CompletionString` here. Then I caught myself not remembering how exactly name lookup works in Python. I tried to find a specification, but to no avail. Now I'm not sure what's right and what's wrong. https://github.com/llvm/llvm-project/pull/160296 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
