You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Hack will type exceptions an nothing for try {} blocks if there is no way for them to throw. HHVM now throws exceptions on non exhaustive switches. Hack is not aware of this fact and will therefore assume the catch block is unreachable, when it can be reached.
Standalone code, or other way to reproduce the problem
Invoke script (\TypeError thrown, since \RuntimeException is not a subtype of nothing.)
Expected behavior
The type of $e should be \RuntimeException for the typechecker.
Actual behavior
hh_client
No errors!
===
Fatal error: Uncaught TypeError:
Argument 1 passed to takes_nothing() must be an instance of nothing,
RuntimeException given in /path/to/main.hack:13
Stack trace:
#0 /path/to/main.hack(8): takes_nothing()
#1 (): main()
#2 {main}
Environment
Operating system
Ubuntu 20.04
Installation method
apt-get with dl.hhvm.com repository
HHVM Version
hackc-f96b1ec9eaa436d00ddd39e08e2231478d47e50e-4.80.0
HipHop VM 4.80.0 (rel)
Compiler: 1603141480_003241999
Repo schema: d1ae8e21bf3419a65f12a010527485564e719d07
The text was updated successfully, but these errors were encountered:
Describe the bug
Hack will type exceptions an
nothing
fortry {}
blocks if there is no way for them to throw. HHVM now throws exceptions on non exhaustive switches. Hack is not aware of this fact and will therefore assume the catch block is unreachable, when it can be reached.Standalone code, or other way to reproduce the problem
Steps to reproduce the behavior:
\TypeError
thrown, since\RuntimeException
is not a subtype ofnothing
.)Expected behavior
The type of
$e
should be\RuntimeException
for the typechecker.Actual behavior
Environment
The text was updated successfully, but these errors were encountered: