hhvm
hhvm copied to clipboard
Internal error: Could not find class when running hh_client --lint --json
I am creating a test triggering hh_client --lint --json
against some temporary files.
The content of the temporary source file is like
/*
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
final class Test {
private static function testThis() {
\SomeNamespace\__Private\SomeEnumName::SOME_VALUE;
}
}
Even though this file should not type check, I would expect no lint errors should be reported.
However, when hh_client --lint path/to/the/temporary/file.hack --json
is running, sometimes hh_client
prints the following error:
{"descr":"Internal error: Could not find class","severity":"error","path":"\/workspaces\/hhast\/.var\/tmp\/hhast\/HHClientDuplicatedLintErrorTest\/1902a47e82576d16a1e026e177dc583b.php","line":9,"start":13,"end":16,"code":0,"bypass_changed_lines":false,"original":"","replacement":""}
To trigger this bug:
git clone https://github.com/atry/hhast.git --branch hhvm-bug-report && cd hhast && composer install && vendor/bin/hacktest tests/HHClientDuplicatedLintErrorTest.hack
This bug is not reproducible from manual execution of hh_client --lint --json
, because it only happens when the temporary file is newly created (maybe while the typechecking is still running?) and there are many concurrent hh_client
calls (some race condition?).