mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 13:30:49 -05:00
## 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>