hhvm / hack-codegen

Library to programatically generate Hack code and write it to signed files
https://hhvm.github.io/hack-codegen/
MIT License
341 stars 93 forks source link

`--format-generated-code` is not recognized by hackfmt #134

Closed lexidor closed 4 years ago

lexidor commented 4 years ago

When running on hhvm 4.68 (and others), this code throws.

// HHVM < 4.48 always formats generated code. HHVM 4.48 never does (so this
// formatter is broken on that version). HHVM >= 4.49 formats generated code
// iff the following flag is provided:
if (\version_compare(\HHVM_VERSION, '4.49') >= 0) {
  $options[] = '--format-generated-code';
}

Hackfmt emits this message: hackfmt: unknown option '--format-generated-code'. Can this be removed safely, without breaking someone's build on some version?

jjergus commented 4 years ago

That's weird, I'm not sure what's going on, because the option exists in the latest HHVM version and I don't remember it failing on any other versions recently. Can you provide the exact commands to reproduce it + exact output? Do you have multiple HHVM versions installed so it could be running hackfmt from a different version accidentally?

lexidor commented 4 years ago

Indeed, there was something wrong with my local install. After apt get purge hhvm hackfmt was still there. which hackfmt returned /usr/local/bin/hackfmt. I have sudo rm'ed /usr/local/bin/hackfmt and reinstalled hhvm. which hackfmt now returns /usr/bin/hackfmt. This now formats the code as expected.

Thanks for the help, I didn't know my install was dirty. :thinking: how this got to be, I don't know.