问题
I am following the instruction in Getting started on official Hacklang website.
As it says, I run:
$ touch .hhconfig
$ mkdir bin src tests
$ cat > hh_autoload.json
{
"roots": [
"src/"
],
"devRoots": [
"tests/"
],
"devFailureHandler": "Facebook\\AutoloadMap\\HHClientFallbackHandler"
}
$ composer require hhvm/hsl hhvm/hhvm-autoload
Then I run hh_client
, which throws 74 errors like those:
Typing[4110] You cannot use HH_FIXME or HH_IGNORE_ERROR comments to suppress error 4110
--> vendor/autoload.hack
318 | \HH\autoload_set_paths(/* HH_FIXME[4110] incorrect hhi */ $map, Generated\root());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Typing[4110] Invalid argument
--> vendor/autoload.hack
318 | \HH\autoload_set_paths(/* HH_FIXME[4110] incorrect hhi */ $map, Generated\root());
| ^^^^
--> /private/tmp/hh_server/hhi_3f14b466/functions.hhi
82 | KeyedContainer<string, KeyedContainer<string, string>> $map,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected KeyedContainer<string, string>
--> vendor/hhvm/hhvm-autoload/src/FailureHandler.hack
46 | final public function handleFailure(string $kind, string $name): void {
| ^^^^^^^^^^^^^ But got (function(string $kind, string $name): void)
Naming[2050] You cannot use HH_FIXME or HH_IGNORE_ERROR comments to suppress error 2050
--> vendor/bin/hh-autoload.hack
179 | GenerateScript::main(vec(/* HH_IGNORE_ERROR[2050] */ $GLOBALS['argv']));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
...
Those errors are related to hh_autoload and hsl package installed through composer.
Why is it???
回答1:
The Hack typechecker recently (as of HHVM 4.62) changed from 'allow by default' to 'ban by default' for error codes in HH_FIXME comments.
Try adding this to your .hhconfig
:
allowed_fixme_codes_strict = 2050, 4110
来源:https://stackoverflow.com/questions/62978039/hh-client-reports-errors-on-package