Skip to content

Conversation

@AlexWaygood
Copy link
Member

Summary

Fixes astral-sh/ty#1571.

I realised I was overcomplicating things when I described what we should do in that issue description. The simplest thing to do here is just to special-case call expressions and short-circuit the call-binding machinery entirely if we see it's NotImplemented being called. It doesn't really matter if the subdiagnostic doesn't fire when a union is called and one element of the union is NotImplemented -- the subdiagnostic doesn't need to be exhaustive; it's just to help people in some common cases.

Test Plan

Added snapshots

@AlexWaygood AlexWaygood added ty Multi-file analysis & type inference diagnostics Related to reporting of diagnostics. labels Nov 19, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Nov 19, 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 Nov 19, 2025

mypy_primer results

Changes were detected when running on open source projects
pywin32 (https://github.com/mhammond/pywin32)
- com/win32com/demos/excelRTDServer.py:239:15: error[call-non-callable] Object of type `NotImplementedType` is not callable
+ com/win32com/demos/excelRTDServer.py:239:15: error[call-non-callable] `NotImplemented` is not callable - did you mean `NotImplementedError`?
- com/win32com/demos/excelRTDServer.py:278:15: error[call-non-callable] Object of type `NotImplementedType` is not callable
+ com/win32com/demos/excelRTDServer.py:278:15: error[call-non-callable] `NotImplemented` is not callable - did you mean `NotImplementedError`?

No memory usage changes detected ✅

@AlexWaygood AlexWaygood merged commit a8f7ccf into main Nov 19, 2025
43 checks passed
@AlexWaygood AlexWaygood deleted the alex/notimplemented-hint branch November 19, 2025 19:27
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.

Add subdiagnostic hint for NotImplemented()

3 participants