facebook / facebook/pyrefly

Wrong typechecking with Literal['a','b','c'] for params unpacked from **{"arg":"a"}

Open
#4,574 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

```python
def fun(arg:Literal['a','b','c']):
pass

params={'arg':'a'}
fun(**params) # Argument `str` is not assignable to parameter `arg` with type `Literal['a', 'b', 'b']` in function `fun`Pyrefly[bad-argument-type](https://pyrefly.org/en/docs/error-kinds/#bad-argument-type)
```

### Sandbox Link

_No response_

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

pyrefly version 1.2.0

Contributor guide

Open the contributing guide

Research direction

Start with the Python reproduction in the issue and trace Pyrefly's handling of arguments unpacked from **params during Literal inference. Done when the shown call is accepted without a bad-argument-type diagnostic and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
compilers, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.