facebook / facebook/pyrefly

bad-argument-count false positive with unpacking

Open
#3,138 3 comments 0 reactions 1 assignee Claimed by @asukaminato0721 View on GitHub
google needs-discussion stale typechecking
Dominant language
Rust
Stars
7k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Reproducer:

```
def f(x, y, z): ...

def test(xs: list[int]):
f(*xs[-4:-2], 42)
```

Output:

```
ERROR Expected 3 positional arguments, got 4 in function `f` [bad-argument-count]
--> /tmp/foo.py:4:17
|
4 | f(*xs[-4:-2], 42)
| ^^
|
INFO 1 error
```

Even though `xs[-4:-2]` has no more than 2 elements (with indices -4 and -3).

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.