Skip to content

Conversation

@dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Apr 28, 2025

Summary

As mentioned in the spec (https://typing.python.org/en/latest/spec/overload.html#invalid-overload-definitions), part of #15383:

The @overload-decorated definitions must be followed by an overload implementation, which does not include an @overload decorator. Type checkers should report an error or warning if an implementation is missing. Overload definitions within stub files, protocols, and on abstract methods within abstract base classes are exempt from this check.

Test Plan

Remove TODOs from the test; create one diagnostic snapshot.

@dhruvmanila dhruvmanila added ty Multi-file analysis & type inference diagnostics Related to reporting of diagnostics. labels Apr 28, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Apr 28, 2025

mypy_primer results

No ecosystem changes detected ✅

@dhruvmanila dhruvmanila force-pushed the dhruv/check-invalid-overloads branch from 3fbeae4 to 8a219b5 Compare April 29, 2025 13:45
@dhruvmanila dhruvmanila force-pushed the dhruv/overload-without-implementation branch from cb23a34 to 24158a7 Compare April 29, 2025 13:46
@dhruvmanila
Copy link
Member Author

dhruvmanila commented Apr 29, 2025

I need to check why this branch is failing on "porcupine" project in mypy-primer.

Edit: #17609 (comment) for why this failure is happening.

@dhruvmanila dhruvmanila force-pushed the dhruv/overload-without-implementation branch from 24158a7 to 10c5adf Compare April 29, 2025 16:16
@dhruvmanila
Copy link
Member Author

Fixed the failure in 382b15b (#17609)

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

Looks great!

Base automatically changed from dhruv/check-invalid-overloads to main April 30, 2025 14:07
@dhruvmanila dhruvmanila force-pushed the dhruv/overload-without-implementation branch from 10c5adf to 9db545d Compare April 30, 2025 14:08
@dhruvmanila dhruvmanila merged commit 7825975 into main Apr 30, 2025
35 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/overload-without-implementation branch April 30, 2025 14:24
dcreager added a commit that referenced this pull request May 1, 2025
* main:
  [red-knot] Preliminary `NamedTuple` support (#17738)
  [red-knot] Add tests for classes that have incompatible `__new__` and `__init__` methods (#17747)
  Update dependency vite to v6.2.7 (#17746)
  [red-knot] Update call binding to return all matching overloads (#17618)
  [`airflow`] apply Replacement::AutoImport to `AIR312` (#17570)
  [`ruff`] Add fix safety section (`RUF028`) (#17722)
  [syntax-errors] Detect single starred expression assignment `x = *y` (#17624)
  py-fuzzer: fix minimization logic when `--only-new-bugs` is passed (#17739)
  Fix example syntax for pydocstyle ignore_var_parameters option (#17740)
  [red-knot] Update salsa to prevent panic in custom panic-handler (#17742)
  [red-knot] Ban direct instantiation of generic protocols as well as non-generic ones (#17741)
  [red-knot] Lookup of `__new__` (#17733)
  [red-knot] Check decorator consistency on overloads (#17684)
  [`flake8-use-pathlib`] Avoid suggesting `Path.iterdir()` for `os.listdir` with file descriptor (`PTH208`) (#17715)
  [red-knot] Check overloads without an implementation (#17681)
  Expand Semantic Syntax Coverage (#17725)
  [red-knot] Check for invalid overload usages (#17609)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics. ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants