[ty] Add positional-only-parameter-as-kwarg error (#20495)

This commit is contained in:
fgiacome 2025-09-23 16:10:45 +02:00 committed by GitHub
parent 2c916562ba
commit 4ed8c65d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 192 additions and 76 deletions

View file

@ -90,8 +90,7 @@ still continue to use the old convention, so it is supported by ty as well.
def f(__x: int): ...
f(1)
# error: [missing-argument]
# error: [unknown-argument]
# error: [positional-only-parameter-as-kwarg]
f(__x=1)
```
@ -131,11 +130,9 @@ class C:
@staticmethod
def static_method(self, __x: int): ...
# error: [missing-argument]
# error: [unknown-argument]
# error: [positional-only-parameter-as-kwarg]
C().method(__x=1)
# error: [missing-argument]
# error: [unknown-argument]
# error: [positional-only-parameter-as-kwarg]
C.class_method(__x="1")
C.static_method("x", __x=42) # fine
```