ruff
e4ba2939 - [ty] Fix `__file__` type in completions to show `str` instead of `str | None` (#22510)

Commit
6 days ago
[ty] Fix `__file__` type in completions to show `str` instead of `str | None` (#22510) ## Summary The type inference system already correctly special-cases `__file__` to return `str` for the current module (since the code is executing from an existing file). However, the completion system was bypassing this logic and pulling `__file__: str | None` directly from `types.ModuleType` in typeshed. This PR adds implicit module globals (like `__file__`, `__name__`, etc.) with their correctly-typed values to completions, reusing the existing `module_type_implicit_global_symbol` function that already handles the special-casing. Closes https://github.com/astral-sh/ty/issues/2445. --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Author
Parents
Loading