I am pretty new to hacklang. I have a piece of code (copied from the HSL github page)
use namespace HHLib{Vec,Dict,Keyset,Str,Math}; function main(vec<?int> $foo): vec<string> { return $foo |> Vecfilter_nulls($$) |> Vecmap($$, $it ==> (string) $it); }
Filename: abc.hack My composer.json looks like
{ "require": { "hhvm/hhvm-autoload": "^3.1", "hhvm/hsl": "^4.41" }, "require-dev": { "hhvm/hhast": "^4.64", "hhvm/hacktest": "^2.2", "facebook/fbexpect": "^2.7" } }
I have included hsl . What am I doing wrong here ? I tested with other HSL functions as well , looks like hh_client is not able to detect the HSL functions and throw Unbound name (typing): HHLibVecfilter_nulls sort of error.
Advertisement
Answer
As discussed in the comments, ignored_paths: ["vendor/*"]
(ignored_paths
being an hhconfig option available since 3.23) was preventing the typechecker from knowing about HSL for the OP. Generally speaking, suppressing errors in vendor
isn’t straightforward, and requires a bit of research to keep the necessary definitions exposed to the typechecker.