facebook / hhvm

A virtual machine for executing programs written in Hack.
https://hhvm.com
Other
18.19k stars 3k forks source link

[ hackfmt ] Hackfmt fails to format modern `xhp class` declarations #9165

Open lexidor opened 2 years ago

lexidor commented 2 years ago

Describe the bug Hackfmt fails to format files containing xhp class declarations.

Standalone code, or other way to reproduce the problem

Placed in file.hack

xhp class F {
            }

Steps to reproduce the behavior:

  1. hackfmt file.hack

Expected behavior

Expected format output like this:

xhp class F {
}

Actual behavior

$ hackfmt file.hack
(1,5)-(1,5) Encountered unexpected token `XHP`.
File failed to parse without errors

Environment


HipHop VM 4.102.7 (rel) Compiler: 1647389495_389373763 Repo schema: d1ae8e21bf3419a65f12a010527485564e719d07 hackc-d09f6f5fa7d62773a2784453de10384260f720d7-4.102.7


HipHop VM 4.128.4 (rel) (non-lowptr) Compiler: 1648578890_742766188 Repo schema: 3bffe303632e801137165e448a12a0707742584f hackc-8b25016efed065c93522fd47cf375a24a364ab71-4.128.4


HipHop VM 4.164.0 (rel) (non-lowptr) Compiler: 1657309234_951459400 Repo schema: c762591bd64e87a7b3be143e72e4a2e69ad9179f hackc-34126416fe6f3d0ed29cbc7bc914e61c3c7607e4-4.164.0