We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2955e3c commit c8c9d57Copy full SHA for c8c9d57
2 files changed
mypy/plugins/default.py
@@ -217,7 +217,7 @@ def get_class_decorator_hook_2(
217
218
def len_callback(ctx: FunctionContext) -> Type:
219
"""Infer a better return type for 'len'."""
220
- if len(ctx.arg_types) == 1:
+ if len(ctx.arg_types) == 1 and len(ctx.arg_types[0]) == 1:
221
arg_type = ctx.arg_types[0][0]
222
arg_type = get_proper_type(arg_type)
223
if isinstance(arg_type, Instance) and arg_type.type.fullname == "librt.vecs.vec":
test-data/unit/check-vec.test
@@ -43,3 +43,7 @@ T = TypeVar("T")
43
44
def bad_generic_func(v: vec[T]) -> None: ... # E: Invalid item type for "vec"
45
[builtins fixtures/len.pyi]
46
+
47
+[case testLenNoArgs]
48
+len() # E: Too few arguments for "len"
49
+[builtins fixtures/len.pyi]
0 commit comments