Skip to content

Add optional concrete fallback definition after overload stubs#313

Open
dyollb wants to merge 2 commits into
pybind:mainfrom
dyollb:print_overload_fallback
Open

Add optional concrete fallback definition after overload stubs#313
dyollb wants to merge 2 commits into
pybind:mainfrom
dyollb:print_overload_fallback

Conversation

@dyollb

@dyollb dyollb commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Add optional concrete fallback definition after overload stubs

Why:

Some tools (for example Griffe during re-export resolution) cannot reliably resolve symbols defined only as overload stubs. Emitting a concrete non-overload signature after the overload set preserves typing quality while ensuring symbol resolution works.

What:

  1. Added a new CLI option: --print-overload-fallback.
  2. Updated Printer emission flow to append one concrete fallback definition after overloaded function/method groups when the option is enabled.
  3. Kept existing @typing.overload signatures unchanged for typing precision.
  4. Refactored fallback processing logic to reduce duplication between function and method paths.
  5. Added/updated tests to verify:
  6. fallback is emitted when enabled,
  7. fallback is not emitted when disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant