[TSP] Pyrefly: completions on an Enum class omit the declared members and Enum API (click ParameterSource)
fixed in next version (main)team needs to reproduce
[TSP] Found via differential testing comparing Pylance's built-in Pyright analyzer against [Pyrefly](https://github.com/facebook/pyrefly) running as an external type server over the Type Server Protocol (TSP).
## Summary
Member-access completions on an **`enum.Enum` subclass accessed as a class** are missing the declared enum members and the `Enum`/`EnumMeta` API surface under Pyrefly. Completing after `ParameterSource.` returns **24** items vs **68** from Pylance's built-in analyzer. Every Pyrefly item is also returned by the built-in analyzer (strict subset), and the **44 missing items include the five actual enum members** (`COMMANDLINE`, `DEFAULT`, `DEFAULT_MAP`, `ENVIRONMENT`, `PROMPT`).
## Repro
1. `git clone https://github.com/pallets/click.git`
2. `git checkout 874ca2bc1c30d93a4ac6e36a15ed685eafe89097` (8.1.7)
3. Create a venv and `pip install -e .`
4. Open `src/click/core.py`.
5. Trigger completions immediately after `ParameterSource.`, e.g. on the line:
```py
source = ParameterSource.COMMANDLINE
```
(`ParameterSource` is `class ParameterSource(enum.Enum)`.)
To switch backends: set `python.analysis.typeServerExecutable` to the Pyrefly binary to get the Pyrefly result; leave it unset to get the built-in (Pyright) result.
## Expected (Pylance / built-in Pyright)
68 completion items, including the declared enum members and the Enum API.
## Actual (Pyrefly over TSP)
24 completion items (only generic `object`/`type` dunders). The following **44 members are missing**, including the actual enum members and the `Enum`/`EnumMeta` surface:
```
__annotations__, __base__, __bases__, __basicsize__, __bool__, __call__, __contains__,
__copy__, __deepcopy__, __delattr__, __dict__, __dictoffset__, __dir__, __doc__, __eq__,
__flags__, __format__, __getattribute__, __getitem__, __getstate__, __hash__, __init__,
__init_subclass__, __instancecheck__, __itemsize__, __iter__, __len__, __members__,
__module__, __mro__, __name__, __ne__, __new__, __or__, __order__, __prepare__,
__qualname__, __reduce__, __reduce_ex__, __repr__, __reversed__, __ror__, __setattr__,
__sizeof__, __str__, __subclasscheck__, __subclasses__, __subclasshook__,
__text_signature__, __weakrefoffset__, _generate_next_value_, _ignore_, _member_map_,
_member_names_, _missing_, _name_, _order_, _value_, _value2member_map_,
COMMANDLINE, DEFAULT, DEFAULT_MAP, ENVIRONMENT, PROMPT, mro, name, value
```
The most user-visible gap is that the enum's own members (`COMMANDLINE`, `DEFAULT`, `DEFAULT_MAP`, `ENVIRONMENT`, `PROMPT`) and the common Enum API (`name`, `value`, `__members__`) are not offered.
## Environment
- Pyrefly: `pyrefly 1.1.1`
- `python.analysis` Python version: 3.11
- OS: Windows
2 条评论