mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Fixes issue #17840 (shows signature of __call__ for incompatible function argument)

Open aybdee opened this issue 1 year ago • 5 comments

Fixes issue #17840 (shows signature of call for incompatible function argument) made modifications to messages.py

  • created a note_call_message function to just return the note message for call type instead of emitting the note
  • implemented changes to fix issue #17840

wrote one unit test in check-callable:testCallableSubtypingTrivialSuffix

aybdee avatar Oct 03 '24 11:10 aybdee

Diff from mypy_primer, showing the effect of this PR on open source code:

werkzeug (https://github.com/pallets/werkzeug)
+ tests/test_formparser.py:436: note: "TStreamFactory.__call__" has type "Callable[[], Any]"

github-actions[bot] avatar Oct 03 '24 11:10 github-actions[bot]

also added added notes to some tests in check-inference.test and check-protocols.test

aybdee avatar Oct 03 '24 13:10 aybdee

Diff from mypy_primer, showing the effect of this PR on open source code:

werkzeug (https://github.com/pallets/werkzeug)
+ tests/test_formparser.py:436: note: "TStreamFactory.__call__" has type "Callable[[], Any]"

github-actions[bot] avatar Oct 03 '24 13:10 github-actions[bot]

Thank you for the feedback, i've implemented the changes

aybdee avatar Oct 08 '24 12:10 aybdee

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/application.py:1093:38: note: "RoleFunction.__call__" has type "Callable[[str, str, str, int, Inliner, DefaultArg(dict[str, Any] | None, 'options'), DefaultArg(Sequence[str], 'content')], tuple[list[Node], list[system_message]]]"

werkzeug (https://github.com/pallets/werkzeug)
+ tests/test_formparser.py:436: note: "TStreamFactory.__call__" has type "Callable[[Arg(int | None, 'total_content_length'), Arg(str | None, 'content_type'), Arg(str | None, 'filename'), DefaultArg(int | None, 'content_length')], IO[bytes]]"

github-actions[bot] avatar Oct 08 '24 13:10 github-actions[bot]