-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[ hh_client --lint | Lint[5607] ] False negative, comparing an interface to a scalar does not emit a warning #9563
Comments
This appears to be fixed on the latest
|
@mszabo-wikia Am I ever glad I checked my notifications this evening. You have made |
Thanks, it has indeed been a journey. This is all still very preliminary but at least better than nothing. The CI specifically is still rather unstable, but worst case the PR should be buildable now with an LLVM 18 toolchain provided other dependencies are met. |
Describe the bug
Comparing a scalar to an interface (other than
Stringish
andXHPChild
), should emit a warningLint[5607] Invalid comparison: This expression will always return false.
.Standalone code, or other way to reproduce the problem
Steps to reproduce the behavior:
hh_client --lint filename.hack
Expected behavior
Two lint errors (one in caught, and one in uncaught)
Actual behavior
Environment
Additional context
I think there may be a special case for
Stringish
and/orXHPChild
that is tripping this linter up.
Stringish === string
is a valid comparison,since
string ""implements"" Stringish
.Even though interfaces are non-exclusive,
string
only implementsXHPChild
andStringish
, so for the purposes of this check,implementing
SomeInterface
impliesnot string
.This issue also reproduces for all scalars (int, bool, float, string),
so
int === SomeInterface
should always be false.The only common interface between a value of
SomeInterface
andint
is
XHPChild
, which can be eliminated with the same logic thatStringish
could for the string case above.The text was updated successfully, but these errors were encountered: