facebook / facebook/hhvm

Introduce a new `/* HH_TRACE[$var] */` annotation

Open
#8,849 3 comments 0 reactions 0 assignees View on GitHub
feature request hack
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

while analyzing a script, it would be nice to be able to inspect the type of a variable if it's not a parameter.

e.g:
```
$pattern = re"/(?PPHP)/";
```

`$pattern` in this case is `shape(0 => string, 'langauge' => string)`, however, the only way to know this statically, is by using an editor with hack plugin, which would ask hh_client for the information.

## request

This issue requests a new hh_client "annotation" `HH_TYPE`/`HH_TRACE` which will result in an error that contains type information about given variable ( e.g: https://cloud.void.tn/c/36?version=4.114.0 )

This feature is inspired by psalm trace feature: https://psalm.dev/r/1602ca9415

Contributor guide

Open the contributing guide

Research direction

Start by reading the requested hh_client annotation behavior, including the proposed HH_TYPE/HH_TRACE names and the linked type-inspection example. Compare the requested output with Psalm's trace feature, then define the annotation syntax, error contents, and validation needed for a variable such as $pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, php
Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.