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

Wrong assumption in for condition - Comparison operation ">" between int<17, 100> and 0 is always true. #5707

Closed
mvorisek opened this issue Oct 1, 2021 · 3 comments
Labels
Milestone

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Oct 1, 2021

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/9611d207-0007-4d39-b84f-20daf3a5f577

Expected output

no error

maybe related with #5656 , but this is much simpler demo

@mvorisek mvorisek changed the title Wrong condition assumption in for condition - Comparison operation ">" between int<17, 100> and 0 is always true. Wrong assumption in for condition - Comparison operation ">" between int<17, 100> and 0 is always true. Oct 1, 2021
@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Oct 11, 2021
@phpstan-bot
Copy link
Contributor

@mvorisek After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-11: Dumped type: int<20, 100>
-13: Comparison operation ">" between int<17, 100> and 0 is always true.
+11: Dumped type: int<20, 100>
Full report
Line Error
11 Dumped type: int<20, 100>

@mvorisek
Copy link
Contributor Author

thanks!

ondrejmirtes added a commit to phpstan/phpstan-src that referenced this issue Jan 13, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants