0

I have written a fair bit of code in Hack, but the typechecker manages to surprise me.

For example, the IDE complains on these two lines:

The first clearly uses a string array and the second clearly returns an integer. Yet, the Nuclide IDE dives me this very unhelpful error message:

"Un-type checked code. Consider adding annotations."

Is this a bug / missing functionality in the typechecker or am I doing something wrong?

Janos Pasztor
  • 1,265
  • 8
  • 16
  • I've made some toy examples and can't reproduce your error. What version of HHVM are you running, and do you get the same errors with `hh_client`? – concat Dec 25 '16 at 05:21
  • I cannot reproduce the error with hh_client because it crashes whenever I try to generate a coverage report with hh_client check --coverage ./src. My HHVM version is 3.15.3 – Janos Pasztor Dec 26 '16 at 20:41
  • I'm unfamiliar with what `hh_client --coverage` is meant for; I'm also getting a fatal, but vanilla `hh_client check` shows no errors. Is your code mixed PHP and Hack? – concat Dec 26 '16 at 23:07
  • No, my code is 100% pure Hack, check the link in my question. The coverage option is supposed to check how much of the code the typechecker can check. Not being able to check the code does not result in an error message with the normal check. – Janos Pasztor Dec 27 '16 at 10:43
  • I still get a fatal after excising the integer casts in your code. Not to mention, `Fatal error: exception End_of_file` doesn't sound like it's related to those lines. I get that when generating a coverage report for your project on HHVM 3.16.0. – concat Dec 28 '16 at 19:35
  • Very odd indeed. I'm getting this: `Error, only read 0 bytes for preamble. Fatal error: exception Marshal_tools.Reading_Preamble_Exception` – Janos Pasztor Dec 28 '16 at 20:16

0 Answers0