[clang] [libclang/python] Fix some type errors, add type annotations (PR #98745)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 13 07:10:58 PDT 2024


================
@@ -2318,25 +2356,25 @@ def kind(self):
         """Return the kind of this type."""
         return TypeKind.from_id(self._kind_id)
 
-    def argument_types(self):
+    def argument_types(self) -> NoSliceSequence[Type]:
         """Retrieve a container for the non-variadic arguments for this type.
 
         The returned object is iterable and indexable. Each item in the
         container is a Type instance.
         """
 
-        class ArgumentsIterator(collections.abc.Sequence):
----------------
DeinAlptraum wrote:

This is a type-error since `ArgumentsIterator` doesn't actually implement the `Sequence` protocol: it does not support slicing.

https://github.com/llvm/llvm-project/pull/98745


More information about the cfe-commits mailing list