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

Pyre does not reason about if statements with logical operators #903

Open
bigfootjon opened this issue Aug 1, 2024 · 1 comment
Open

Comments

@bigfootjon
Copy link
Member

bigfootjon commented Aug 1, 2024

Pyre Bug

Pyre does not reason about complex if statements. This is used in e.g. aiohttp:

https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L1034

Reproduction steps

(try commenting and uncommenting the various options to see the various results)

Expected behavior
All of the above if statements should report a type error

Logs
See playground link

@bigfootjon
Copy link
Member Author

Per discussion with @stroxler this code would need to be updated:

https://github.com/facebook/pyre-check/blob/main/source/analysis/preprocessing.ml#L4773-L4774

The likely solution is to switch to a replace-special-values-with-constant-true phase followed by a merge-logical-expressions-phase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant