Incorrect expected type for second arg of `deep_replace`
Open
bug
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
Here is a full repro:
``` python
import libcst as cst
def f(node: cst.Call) -> cst.Call:
arg = node.args[0]
new_arg = arg.with_changes(value=cst.Integer(value="2"))
return node.deep_replace(arg, new_arg)
node = cst.ensure_type(cst.parse_expression("func(1)"), cst.Call)
print(f(node))
```
So we're replacing an `Arg` with an `Arg` in a `Call` node, but type checker complains:
error: Argument 2 to "deep_replace" of "CSTNode" has incompatible type "Arg"; expected "Call" [arg-type]
Contributor guide
Assessment
This issue has not been assessed yet.