Skip to content

Move self argument checks to a later phase - after decorator application, if any #19490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Prev Previous commit
Next Next commit
Sync remaining tests
  • Loading branch information
sterliakov committed Jul 23, 2025
commit 7be5bd39a21d50bf499d4391cb9ebd7e1d12c72d
5 changes: 4 additions & 1 deletion test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -3261,7 +3261,10 @@ b.bad = 'a' # E: Incompatible types in assignment (expression has type "str", v
from typing import Any

class Test:
def __setattr__() -> None: ... # E: Method must have at least one argument. Did you forget the "self" argument? # E: Invalid signature "Callable[[], None]" for "__setattr__"
def __setattr__() -> None: ... \
# E: Invalid signature "Callable[[], None]" for "__setattr__" \
# E: Method must have at least one argument. Did you forget the "self" argument?

t = Test()
t.crash = 'test' # E: Attribute function "__setattr__" with type "Callable[[], None]" does not accept self argument \
# E: "Test" has no attribute "crash"
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/fine-grained.test
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ from typing import Iterator, Callable, List, Optional
from a import f
import a

def dec(f: Callable[['A'], Optional[Iterator[int]]]) -> Callable[[int], int]: pass
def dec(f: Callable[['A'], Optional[Iterator[int]]]) -> Callable[['A', int], int]: pass

class A:
@dec
Expand Down
16 changes: 0 additions & 16 deletions test-data/unit/semanal-errors.test
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,6 @@ def f(y: t): x = t
main:4: error: "t" is a type variable and only valid in type context
main:5: error: "t" is a type variable and only valid in type context

[case testMissingSelf]
import typing
class A:
def f(): pass
[out]
main:3: error: Method must have at least one argument. Did you forget the "self" argument?

[case testInvalidBaseClass]
import typing
class A(B): pass
Expand All @@ -558,15 +551,6 @@ def f() -> None: super().y
main:2: error: "super" used outside class
main:3: error: "super" used outside class

[case testMissingSelfInMethod]
import typing
class A:
def f() -> None: pass
def g(): pass
[out]
main:3: error: Method must have at least one argument. Did you forget the "self" argument?
main:4: error: Method must have at least one argument. Did you forget the "self" argument?

[case testMultipleMethodDefinition]
import typing
class A:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy