You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
User experience with methods and functions making use of type-splat parameters is degraded compared to the equivalent ordinary functions. In particular, "signature help", and also various features of auto-complete (e.g. enum constants) are blocked by the presence of a splat parameter e.g. in the following code
```
class Splat<Targs as (mixed...)> {}
final class TwoInts extends Splat<(int, int)> {}
class MyOtherClass {
public static function genericSplatMethod<Targs as (mixed...)>(
Splat<Targs> $splat,
... Targs $args,
): void {}
}
function testsplat(): void {
MyOtherClass::genericSplatMethod(new TwoInts(), 1, 2);
}
```
Now suppose you are typing the call to `genericSplatMethod` in the IDE and you've typed the first argument. This is the current behaviour:
{F1984875663}
Better would be to see the splat expanded, to multiple arguments:
{F1984875638}
To make this happen, we add a helper function `expand_splat_param_in_function_type` to `Tast_env` that does this expansion of `...(int, int) $args` to `int $args[0], int $args[1]`.
The unexpanded splat also blocks various completions such as enums. Solution is to call the helper function in appropriate places in `autocompleteService.ml`.
Reviewed By: francesco-zappa-nardelli
Differential Revision: D91140789
fbshipit-source-id: 144873217c882837d6cdf9aec4028f96f75903d4
0 commit comments