Skip to content

Conversation

@fjzll
Copy link

@fjzll fjzll commented Oct 31, 2024

Fixes issue #17840.
In incompatible_argument_note method in Class MessageBuilder, the callee needs to be a CallableType for conditions to be met and the note_call to be invoked. So I added callee_type.type.is_protocol in the if statement. When callee_type is Protocol, condition will be met and note_call will be invoked to generate notes when there is a mismatch in the arguments.

fjzll and others added 2 commits October 31, 2024 23:03
…allee_type.type.is_protocol so that note_call wiwll be invoked to produce notes when callee type is protocol
@fjzll fjzll marked this pull request as draft October 31, 2024 15:35
@github-actions
Copy link
Contributor

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

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/SelfTest/Hash/test_BLAKE2.py:421: error: Unused "type: ignore" comment  [unused-ignore]
+ lib/Crypto/SelfTest/Signature/test_pss.py:135: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.14.0+dev.59873c691767ec1b0575fa607d8dead960cbb252
+ lib/Crypto/SelfTest/Signature/test_pss.py:135: : note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2936, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3334, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3435, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2305, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 483, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1458, in accept
+     return visitor.visit_for_stmt(self)
+   File "/checker.py", line 4983, in visit_for_stmt
+     self.accept_loop(s.body, s.else_body)
+   File "/checker.py", line 612, in accept_loop
+     self.accept(body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1364, in accept
+     return visitor.visit_assignment_stmt(self)
+   File "/checker.py", line 3000, in visit_assignment_stmt
+     self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
+   File "/checker.py", line 3217, in check_assignment
+     rvalue_type = self.expr_checker.accept(rvalue, type_context=type_context)
+   File "/checkexpr.py", line 5885, in accept
+     typ = node.accept(self)
+           ^^^^^^^^^^^^^^^^^
+   File "/nodes.py", line 1984, in accept
+     return visitor.visit_call_expr(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 483, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 617, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1474, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+                             ^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1572, in check_call
+     return self.check_callable_call(
+            ^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1799, in check_callable_call
+     self.check_argument_types(
+   File "/checkexpr.py", line 2592, in check_argument_types
+     check_arg(
+   File "/checkexpr.py", line 2639, in check_arg
+     self.msg.incompatible_argument_note(
+   File "/messages.py", line 872, in incompatible_argument_note
+     isinstance(callee_type, CallableType) or callee_type.type.is_protocol
+                                              ^^^^^^^^^^^^^^^^
+ AttributeError: 'UnionType' object has no attribute 'type'

python-htmlgen (https://github.com/srittau/python-htmlgen)
+ test_htmlgen/attribute.py:271: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.14.0+dev.59873c691767ec1b0575fa607d8dead960cbb252
+ test_htmlgen/attribute.py:271: : note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2936, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3334, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3435, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2305, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 483, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+   File "/checker.py", line 2461, in visit_class_def
+     self.accept(defn.defs)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 827, in accept
+     return visitor.visit_func_def(self)
+   File "/checker.py", line 1046, in visit_func_def
+     self._visit_func_def(defn)
+   File "/checker.py", line 1050, in _visit_func_def
+     self.check_func_item(defn, name=defn.name)
+   File "/checker.py", line 1084, in check_func_item
+     self.check_func_def(defn, typ, name, allow_empty)
+   File "/checker.py", line 1360, in check_func_def
+     self.accept(item.body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1633, in accept
+     return visitor.visit_with_stmt(self)
+   File "/checker.py", line 5222, in visit_with_stmt
+     self.accept(s.body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+   File "/checker.py", line 2461, in visit_class_def
+     self.accept(defn.defs)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1364, in accept
+     return visitor.visit_assignment_stmt(self)
+   File "/checker.py", line 3000, in visit_assignment_stmt
+     self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
+   File "/checker.py", line 3217, in check_assignment
+     rvalue_type = self.expr_checker.accept(rvalue, type_context=type_context)
+   File "/checkexpr.py", line 5885, in accept
+     typ = node.accept(self)
+           ^^^^^^^^^^^^^^^^^
+   File "/nodes.py", line 1984, in accept
+     return visitor.visit_call_expr(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 483, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 617, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1474, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+                             ^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1572, in check_call
+     return self.check_callable_call(
+            ^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1799, in check_callable_call
+     self.check_argument_types(
+   File "/checkexpr.py", line 2592, in check_argument_types
+     check_arg(
+   File "/checkexpr.py", line 2639, in check_arg
+     self.msg.incompatible_argument_note(
+   File "/messages.py", line 872, in incompatible_argument_note
+     isinstance(callee_type, CallableType) or callee_type.type.is_protocol
+                                              ^^^^^^^^^^^^^^^^
+ AttributeError: 'TypeType' object has no attribute 'type'

operator (https://github.com/canonical/operator)
+ ops/model.py:3638: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.14.0+dev.59873c691767ec1b0575fa607d8dead960cbb252
+ ops/model.py:3638: : note: use --pdb to drop into pdb
- ops/model.py:450: error: Incompatible types in assignment (expression has type "StatusBase", variable has type "None")  [assignment]
- ops/model.py:624: error: Incompatible types in assignment (expression has type "StatusBase", variable has type "None")  [assignment]
- ops/model.py:3324: error: Unused "type: ignore" comment  [unused-ignore]
- ops/model.py:3327: error: Unused "type: ignore" comment  [unused-ignore]
- ops/model.py:3329: error: Unused "type: ignore" comment  [unused-ignore]
- ops/model.py:3331: error: Unused "type: ignore" comment  [unused-ignore]
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2936, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3334, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3435, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2305, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 483, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+   File "/checker.py", line 2461, in visit_class_def
+     self.accept(defn.defs)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 827, in accept
+     return visitor.visit_func_def(self)
+   File "/checker.py", line 1046, in visit_func_def
+     self._visit_func_def(defn)
+   File "/checker.py", line 1050, in _visit_func_def
+     self.check_func_item(defn, name=defn.name)
+   File "/checker.py", line 1084, in check_func_item
+     self.check_func_def(defn, typ, name, allow_empty)
+   File "/checker.py", line 1360, in check_func_def
+     self.accept(item.body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1458, in accept
+     return visitor.visit_for_stmt(self)
+   File "/checker.py", line 4983, in visit_for_stmt
+     self.accept_loop(s.body, s.else_body)
+   File "/checker.py", line 612, in accept_loop
+     self.accept(body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1364, in accept
+     return visitor.visit_assignment_stmt(self)
+   File "/checker.py", line 3000, in visit_assignment_stmt
+     self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
+   File "/checker.py", line 3217, in check_assignment
+     rvalue_type = self.expr_checker.accept(rvalue, type_context=type_context)
+   File "/checkexpr.py", line 5885, in accept
+     typ = node.accept(self)
+           ^^^^^^^^^^^^^^^^^
+   File "/nodes.py", line 1984, in accept
+     return visitor.visit_call_expr(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 483, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 617, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1474, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+                             ^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1572, in check_call
+     return self.check_callable_call(
+            ^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1799, in check_callable_call
+     self.check_argument_types(
+   File "/checkexpr.py", line 2592, in check_argument_types
+     check_arg(
+   File "/checkexpr.py", line 2639, in check_arg
+     self.msg.incompatible_argument_note(
+   File "/messages.py", line 872, in incompatible_argument_note
+     isinstance(callee_type, CallableType) or callee_type.type.is_protocol
+                                              ^^^^^^^^^^^^^^^^
+ AttributeError: 'UnionType' object has no attribute 'type'
- ops/log.py:73: error: Incompatible types in assignment (expression has type "Callable[[type[BaseException], BaseException, TracebackType], Any]", variable has type "Callable[[type[BaseException], BaseException, TracebackType | None], Any]")  [assignment]
- ops/framework.py:127: error: Argument 1 of "__eq__" is incompatible with supertype "object"; supertype defines the argument type as "object"  [override]
- ops/framework.py:127: note: This violates the Liskov substitution principle
- ops/framework.py:127: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/framework.py:127: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/framework.py:127: note:     def __eq__(self, other: object) -> bool:
- ops/framework.py:127: note:         if not isinstance(other, Handle):
- ops/framework.py:127: note:             return NotImplemented
- ops/framework.py:127: note:         return <logic to compare two Handle instances>
- ops/framework.py:158: error: Incompatible types in assignment (expression has type "list[str]", variable has type "str")  [assignment]
- ops/framework.py:164: error: Unpacking a string is disallowed  [misc]
- ops/framework.py:170: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:582: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:601: error: Incompatible redefinition (redefinition with type "Callable[[Framework], FrameworkEvents]", original type "FrameworkEvents")  [misc]
- ops/framework.py:618: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:796: error: Argument 1 to "register_type" of "Framework" has incompatible type "type[EventBase]"; expected "type[Serializable]"  [arg-type]
- ops/framework.py:917: error: Incompatible types in assignment (expression has type "EventBase", variable has type "Serializable")  [assignment]
- ops/framework.py:917: note: "EventBase" is missing following "Serializable" protocol member:
- ops/framework.py:917: note:     handle_kind
- ops/framework.py:918: error: "Serializable" has no attribute "deferred"  [attr-defined]
- ops/framework.py:957: error: "Serializable" has no attribute "deferred"  [attr-defined]
- ops/framework.py:1096: error: Invalid signature "Callable[[BoundStoredState, Literal['on']], ObjectEvents]" for "__getattr__"  [misc]
- ops/framework.py:1163: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- ops/framework.py:1164: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- ops/framework.py:1230: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:1232: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:1234: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:1289: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:1304: error: Signature of "__getitem__" incompatible with supertype "MutableSequence"  [override]
- ops/framework.py:1304: note:      Superclass:
- ops/framework.py:1304: note:          @overload
- ops/framework.py:1304: note:          def __getitem__(self, int, /) -> Any
- ops/framework.py:1304: note:          @overload
- ops/framework.py:1304: note:          def __getitem__(self, slice[Any, Any, Any], /) -> MutableSequence[Any]
- ops/framework.py:1304: note:      Subclass:
- ops/framework.py:1304: note:          def __getitem__(self, int, /) -> Any
- ops/framework.py:1304: error: Signature of "__getitem__" incompatible with supertype "Sequence"  [override]
- ops/framework.py:1304: note:      Superclass:
- ops/framework.py:1304: note:          @overload
- ops/framework.py:1304: note:          def __getitem__(self, int, /) -> Any
- ops/framework.py:1304: note:          @overload
- ops/framework.py:1304: note:          def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[Any]
- ops/framework.py:1304: note:      Subclass:
- ops/framework.py:1304: note:          def __getitem__(self, int, /) -> Any
- ops/framework.py:1307: error: Signature of "__setitem__" incompatible with supertype "MutableSequence"  [override]
- ops/framework.py:1307: note:      Superclass:
- ops/framework.py:1307: note:          @overload

... (truncated 101 lines) ...

setuptools (https://github.com/pypa/setuptools): 1.50x faster (32.8s -> 21.9s in a single noisy sample)
+ pkg_resources/__init__.py:2780: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.14.0+dev.59873c691767ec1b0575fa607d8dead960cbb252
+ pkg_resources/__init__.py:2780: : note: use --pdb to drop into pdb
- setuptools/extension.py:156: error: Unused "type: ignore" comment  [unused-ignore]
- setuptools/command/install_lib.py:99: error: Unused "type: ignore" comment  [unused-ignore]
- setuptools/command/install_lib.py:100: error: Unused "type: ignore" comment  [unused-ignore]
- setuptools/command/install_lib.py:101: error: Unused "type: ignore" comment  [unused-ignore]
- setuptools/command/build_py.py:53: error: Unused "type: ignore" comment  [unused-ignore]
- setuptools/command/build_py.py:146: error: Unused "type: ignore" comment  [unused-ignore]
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2936, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3334, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3435, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2305, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 483, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+   File "/checker.py", line 2461, in visit_class_def
+     self.accept(defn.defs)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 591, in accept
+     return visitor.visit_overloaded_func_def(self)
+   File "/checker.py", line 629, in visit_overloaded_func_def
+     self._visit_overloaded_func_def(defn)
+   File "/checker.py", line 657, in _visit_overloaded_func_def
+     defn.impl.accept(self)
+   File "/nodes.py", line 827, in accept
+     return visitor.visit_func_def(self)
+   File "/checker.py", line 1046, in visit_func_def
+     self._visit_func_def(defn)
+   File "/checker.py", line 1050, in _visit_func_def
+     self.check_func_item(defn, name=defn.name)
+   File "/checker.py", line 1084, in check_func_item
+     self.check_func_def(defn, typ, name, allow_empty)
+   File "/checker.py", line 1360, in check_func_def
+     self.accept(item.body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1545, in accept
+     return visitor.visit_if_stmt(self)
+   File "/checker.py", line 4728, in visit_if_stmt
+     self.accept(b)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1297, in accept
+     return visitor.visit_expression_stmt(self)
+   File "/checker.py", line 4593, in visit_expression_stmt
+     expr_type = self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
+   File "/checkexpr.py", line 5877, in accept
+     typ = self.visit_call_expr(node, allow_none_return=True)
+           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 483, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 617, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1474, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+                             ^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1572, in check_call
+     return self.check_callable_call(
+            ^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1799, in check_callable_call
+     self.check_argument_types(
+   File "/checkexpr.py", line 2592, in check_argument_types
+     check_arg(
+   File "/checkexpr.py", line 2639, in check_arg
+     self.msg.incompatible_argument_note(
+   File "/messages.py", line 872, in incompatible_argument_note
+     isinstance(callee_type, CallableType) or callee_type.type.is_protocol
+                                              ^^^^^^^^^^^^^^^^
+ AttributeError: 'UnionType' object has no attribute 'type'

altair (https://github.com/vega/altair)
+ tests/vegalite/v5/test_api.py:387: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.14.0+dev.59873c691767ec1b0575fa607d8dead960cbb252
+ tests/vegalite/v5/test_api.py:387: : note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2936, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3334, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3435, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2305, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 483, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 827, in accept
+     return visitor.visit_func_def(self)
+   File "/checker.py", line 1046, in visit_func_def
+     self._visit_func_def(defn)
+   File "/checker.py", line 1050, in _visit_func_def
+     self.check_func_item(defn, name=defn.name)
+   File "/checker.py", line 1084, in check_func_item
+     self.check_func_def(defn, typ, name, allow_empty)
+   File "/checker.py", line 1360, in check_func_def
+     self.accept(item.body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1633, in accept
+     return visitor.visit_with_stmt(self)
+   File "/checker.py", line 5222, in visit_with_stmt
+     self.accept(s.body)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1277, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2951, in visit_block
+     self.accept(s)
+   File "/checker.py", line 592, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1297, in accept
+     return visitor.visit_expression_stmt(self)
+   File "/checker.py", line 4593, in visit_expression_stmt
+     expr_type = self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
+   File "/checkexpr.py", line 5877, in accept
+     typ = self.visit_call_expr(node, allow_none_return=True)
+           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 483, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 617, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1474, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+                             ^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1572, in check_call
+     return self.check_callable_call(
+            ^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/checkexpr.py", line 1799, in check_callable_call
+     self.check_argument_types(
+   File "/checkexpr.py", line 2592, in check_argument_types
+     check_arg(
+   File "/checkexpr.py", line 2639, in check_arg
+     self.msg.incompatible_argument_note(
+   File "/messages.py", line 872, in incompatible_argument_note
+     isinstance(callee_type, CallableType) or callee_type.type.is_protocol
+                                              ^^^^^^^^^^^^^^^^
+ AttributeError: 'UnionType' object has no attribute 'type'

prefect (https://github.com/PrefectHQ/prefect): 2.78x faster (54.2s -> 19.5s in a single noisy sample)
+ src/prefect/utilities/collections.py:124: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build

... (truncated 7099 lines) ...```

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