================
@@ -3149,6 +3073,107 @@ def __str__(self) -> str:
     VERTICAL_SPACE = 20
 
 
+class CompletionChunk:
+    class SpellingCacheAlias:
+        """
+        A temporary utility that acts as an alias to 
CompletionChunk.SPELLING_CACHE.
+        This will be removed without deprecation warning in a future release.
+        Please do not use it directly!
+        """
+
+        deprecation_message = (
+            "'SPELLING_CACHE' has been moved into the scope of 
'CompletionChunk' "
+            "and adapted to use 'CompletionChunkKind's as keys instead of 
their "
+            "enum values. Please adapt all uses of 'SPELLING_CACHE' to use "
+            "'CompletionChunk.SPELLING_CACHE' instead. The old 
'SPELLING_CACHE' "
+            "will be removed in a future release."
+        )
+
+        def __getitem__(self, value: int):
+            warnings.warn(self.deprecation_message, DeprecationWarning)
+            return 
CompletionChunk.SPELLING_CACHE[CompletionChunkKind.from_id(value)]
+        
+        def __contains__(self, value: int):
+            warnings.warn(self.deprecation_message, DeprecationWarning)
+            return CompletionChunkKind.from_id(value) in 
CompletionChunk.SPELLING_CACHE
----------------
Endilll wrote:

I think replicating the behavior `__getitem__` and `__contains__` is enough. We 
can handle the rest by throwing an error from `__getattr__`.

https://github.com/llvm/llvm-project/pull/177586
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to