================
@@ -3197,12 +3188,47 @@ def __repr__(self) -> str:
)
-availabilityKinds = {
- 0: CompletionChunk.Kind("Available"),
- 1: CompletionChunk.Kind("Deprecated"),
- 2: CompletionChunk.Kind("NotAvailable"),
- 3: CompletionChunk.Kind("NotAccessible"),
-}
+# AvailabilityKindCompat is an exact copy of AvailabilityKind, except for
__str__
+# This is a temporary measure to keep the string representation the same
+# until we unify the return of CompletionString.availability to be
AvailabilityKind
+# Note that deriving from AvailabilityKind directly is not possible
+class AvailabilityKindCompat(BaseEnumeration):
+ """
+ Describes the availability of an entity.
+ """
+
+ # Ensure AvailabilityKindCompat is comparable with AvailabilityKind
+ def __eq__(self, other: object) -> bool:
+ if isinstance(other, AvailabilityKind):
+ return self.value == other.value
+ else:
+ return NotImplemented
----------------
Endilll wrote:
I think it'd be better to first check for precondition, then do the work:
```python
if not isinstance(other, AvailabilityKind):
return NotImplemented
return self.value == other.value
```
Also, how does this manage to work when two AvailabilityKindCompats are
compared?
https://github.com/llvm/llvm-project/pull/160296
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits