Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect expected type for second arg of deep_replace #965

Open
kit1980 opened this issue Jul 3, 2023 · 0 comments
Open

Incorrect expected type for second arg of deep_replace #965

kit1980 opened this issue Jul 3, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kit1980
Copy link
Contributor

kit1980 commented Jul 3, 2023

Here is a full repro:

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]

@zsol zsol added the bug Something isn't working label Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants