Skip to content

[ty] Improve check enforcing that an overloaded function must have an implementation#21978

Merged
AlexWaygood merged 1 commit intomainfrom
alex/abcmeta-subclass
Dec 15, 2025
Merged

[ty] Improve check enforcing that an overloaded function must have an implementation#21978
AlexWaygood merged 1 commit intomainfrom
alex/abcmeta-subclass

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Dec 14, 2025

Summary

Fixes astral-sh/ty#1216

Test Plan

Mdtests and snapshots

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Dec 14, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 14, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 14, 2025

mypy_primer results

Changes were detected when running on open source projects
pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/mark/structures.py:495:13: error[invalid-overload] Overloads for function `__call__` must be followed by a non-`@overload`-decorated implementation function
- src/_pytest/mark/structures.py:510:13: error[invalid-overload] Overloads for function `__call__` must be followed by a non-`@overload`-decorated implementation function
- src/_pytest/mark/structures.py:542:13: error[invalid-overload] Overloads for function `__call__` must be followed by a non-`@overload`-decorated implementation function
- Found 443 diagnostics
+ Found 440 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
+ src/scikit_build_core/build/wheel.py:98:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 41 diagnostics
+ Found 42 diagnostics

No memory usage changes detected ✅

@AlexWaygood
Copy link
Member Author

The primer report LGTM. Those pytest hits are all in an if TYPE_CHECKING block: https://github.com/pytest-dev/pytest/blob/af95858c9293e1fddf05116b1f2a38b62ebd36b5/src/_pytest/mark/structures.py#L488. That's exactly the feature this PR is trying to enable

@AlexWaygood AlexWaygood marked this pull request as ready for review December 14, 2025 18:06
Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me — thank you.

@AlexWaygood AlexWaygood merged commit 0b918ae into main Dec 15, 2025
43 checks passed
@AlexWaygood AlexWaygood deleted the alex/abcmeta-subclass branch December 15, 2025 08:56
dcreager added a commit that referenced this pull request Dec 15, 2025
* origin/main:
  Update MSRV to 1.90 (#21987)
  [ty] Improve check enforcing that an overloaded function must have an implementation (#21978)
  Update actions/checkout digest to 8e8c483 (#21982)
  [ty] Use `ParamSpec` without the attr for inferable check (#21934)
  [ty] Emit diagnostic when a type variable with a default is followed by one without a default (#21787)
  [ty] Fix callout syntax in configuration mkdocs (#1875) (#21961)
  Update debug_assert which pointed at missing method (#21969)
  [ty] Add support for `__qualname__` and other implicit class attributes (#21966)
dcreager added a commit that referenced this pull request Dec 15, 2025
* origin/main:
  Fluent formatting of method chains (#21369)
  [ty] Avoid stack overflow when calculating inferable typevars (#21971)
  [ty] Add "qualify ..." code fix for undefined references (#21968)
  [ty] Use jemalloc on linux (#21975)
  Update MSRV to 1.90 (#21987)
  [ty] Improve check enforcing that an overloaded function must have an implementation (#21978)
  Update actions/checkout digest to 8e8c483 (#21982)
  [ty] Use `ParamSpec` without the attr for inferable check (#21934)
  [ty] Emit diagnostic when a type variable with a default is followed by one without a default (#21787)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

don't require overload implementation in TYPE_CHECKING block / treat them the same as stub files

3 participants

Comments