Describe the bug
The code examples on the nameof page lead to parse errors.
Standalone code, or other way to reproduce the problem
class B {}
class C extends B {}
trait T {
require extends B;
public static function f(): void {
var_dump(nameof T); // "T"
var_dump(nameof self); // "D" (user of trait)
var_dump(nameof parent); // "C" (parent of trait user, not B)
var_dump(nameof static); // "E", receiver for ::f() in main
}
}
class D extends C { use T; }
class E extends D {}
<<__EntryPoint>>
function main(): void {
E::f();
}
Steps to reproduce the behavior:
- Copy-paste the above code in
tmp.hack and run hhvm tmp.hack. I tested with the Docker container
Expected behavior
Code should run (or at least parse) properly.
Actual behavior
Fatal error: Encountered unexpected token `T`. in /home/tmp.hack on line 6
Environment
- Operating system: macOS Sonoma 14.2.1
- Installation method: Docker
hhvm/hhvm:latest with sha256:1cc1be0d469a378114112096431145c9fe80612c61ba48e8697097d933147f60
- HHVM Version
HipHop VM 4.172.0 (rel) (non-lowptr)
Compiler: 1667340154_989010953
Repo schema: 63eaf8b56fb7edbc7a8ca9e32786eb0c1f8f508c
Additional context
We're trying to add support for Hack syntax highlighting in Sourcegraph here: https://github.com/sourcegraph/sourcegraph/pull/62770 and were going through the official docs for code examples.
Describe the bug
The code examples on the nameof page lead to parse errors.
Standalone code, or other way to reproduce the problem
Steps to reproduce the behavior:
tmp.hackand runhhvm tmp.hack. I tested with the Docker containerExpected behavior
Code should run (or at least parse) properly.
Actual behavior
Environment
hhvm/hhvm:latestwithsha256:1cc1be0d469a378114112096431145c9fe80612c61ba48e8697097d933147f60Additional context
We're trying to add support for Hack syntax highlighting in Sourcegraph here: https://github.com/sourcegraph/sourcegraph/pull/62770 and were going through the official docs for code examples.