Hack: Allow this as a parameter to a callable in a static member variable
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
### HHVM Version
3.15.0
### Standalone code, or other way to reproduce the problem
``` hack
$callables = [];
public static function getCallables(): array<(function(this):void)> {
return static::$callables;
}
}
```
### Expected result
No errors!
### Actual result
```
The type "this" cannot be used as a constraint on a class' generic, or as the type of a static member variable (Naming[2043])
```
Contributor guide
Research direction
Start with the standalone Hack reproduction and the Naming[2043] diagnostic shown in the issue. Trace the type-checking path for `this` in a static member variable and callable parameter; done means the example type-checks without errors and existing related checks remain valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100