facebook / facebook/hhvm

Add quickfix for missing use block on lambdas

Open
#8,972 0 comments 0 reactions 0 assignees View on GitHub
major-league-hacking
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

Example bad code:

```hack
function foo(): void {
$x = 1;
$f = function() {
return $x;
};
}
```

The quickfix should add the `use` (if not already present), and the extra variable.

```hack
function foo(): void {
$x = 1;
$f = function() use ($x) {
return $x;
};
}
```

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating the Hack lambda quickfix implementation and its tests, then verify handling for lambdas without a use block, lambdas with an existing use block, and the required captured variable; done means the examples receive the requested quickfix.

Written by the indexing model from the issue text.

Assessment

Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.