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

Functions with type variable value restriction lose some AST information #14706

Open
JukkaL opened this issue Feb 15, 2023 · 0 comments
Open
Labels
bug mypy got something wrong

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Feb 15, 2023

There are a bunch of mypy AST attributes that mypy.treetransform.TransformVisitor does not propagate when copying AST nodes. This causes issues in functions using a type variable restriction, since function bodies of such functions are transformed using this visitor before type checking. Based on a user report, I noticed that async-related flags aren't propagated. I also noticed a few others, including dataclass transform state. It's not clear if all of these are causing actual issues, but some of them might.

We should go through all AST nodes and double check that all relevant state is being copied. Not sure if there is an easy way to test exhaustively that we don't miss any attributes as AST attributes are added.

@JukkaL JukkaL added the bug mypy got something wrong label Feb 15, 2023
JukkaL added a commit that referenced this issue Apr 24, 2023
Propagate additional function flags in TransformVisitor.

Work on #14706.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant