-
Notifications
You must be signed in to change notification settings - Fork 226
Closed
Labels
bugSomething isn't workingSomething isn't workingcallsIssues relating to call-signature checking and diagnosticsIssues relating to call-signature checking and diagnosticsgenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation
Milestone
Description
Summary
ty reports error[missing-argument] when setting a method in a class from staticmethod(foo). It works as expected when __call__ is set with the @staticmethod decorator. I discovered this behaviour when working with the SymPy v1.14 SingletonRegistry.
Minimal reproduction:
def foo(*args, **kwargs) -> None:
print("foo", args, kwargs)
class A:
__call__ = staticmethod(foo)
bar = staticmethod(foo)
a = A()
a()
a.bar()
a(5)
a.bar(5)
a(x=10)
a.bar(x=10)Result from ty check:
$ uv run ty check test.py
error[missing-argument]: No arguments provided for required parameters `*args`, `**kwargs`
--> test.py:17:1
|
16 | a = A()
17 | a()
| ^^^
18 | a.bar()
|
info: Union variant `[**_P'return, _R_co'return](**_P'return@staticmethod) -> _R_co'return` is incompatible with this call site
info: Attempted to call union type `A`
info: These arguments are required because `ParamSpec` `_P'return` could represent any set of parameters at runtime
info: rule `missing-argument` is enabled by default
error[missing-argument]: No arguments provided for required parameters `*args`, `**kwargs`
--> test.py:18:1
...
error[missing-argument]: No argument provided for required parameter `**kwargs`
--> test.py:20:1
...
error[missing-argument]: No argument provided for required parameter `**kwargs`
--> test.py:21:1
...
error[missing-argument]: No argument provided for required parameter `*args`
--> test.py:22:1
...
error[missing-argument]: No argument provided for required parameter `*args`
--> test.py:23:1
...
Found 6 diagnostics
Actual behaviour:
$ uv run test.py
foo () {}
foo () {}
foo (5,) {}
foo (5,) {}
foo () {'x': 10}
foo () {'x': 10}
Version
ty 0.0.15
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcallsIssues relating to call-signature checking and diagnosticsIssues relating to call-signature checking and diagnosticsgenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation