Skip to content

Commit c845501

Browse files
committed
Fix some test failures
1 parent 32f05cb commit c845501

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

mypy/checkmember.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def analyze_member_access(name: str,
8787
msg.cant_assign_to_method(node)
8888
signature = function_type(method, builtin_type('builtins.function'))
8989
signature = freshen_function_type_vars(signature)
90-
if name == '__new__':
90+
if name == '__new__' or method.is_static:
9191
# __new__ is special and behaves like a static method -- don't strip
9292
# the first argument.
9393
pass

mypy/nodes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ def items(self) -> List[OverloadPart]:
693693
def is_property(self) -> bool:
694694
return self.func.is_property
695695

696+
@property
697+
def is_static(self) -> bool:
698+
return self.func.is_static
699+
696700
@property
697701
def is_class(self) -> bool:
698702
return self.func.is_class

test-data/unit/check-abstract.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ class A(metaclass=ABCMeta):
749749
def x(self) -> int: pass
750750
class B(A):
751751
@property
752-
def x(self) -> str: pass # E: Return type of "x" incompatible with supertype "A"
752+
def x(self) -> str: pass # E: Signature of "x" incompatible with supertype "A"
753753
b = B()
754754
b.x() # E: "str" not callable
755755
[builtins fixtures/property.pyi]

test-data/unit/check-inference.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,9 +1392,8 @@ class A:
13921392
self.x = [] # E: Need type annotation for 'x'
13931393

13941394
class B(A):
1395-
# TODO?: This error is kind of a false positive, unfortunately
13961395
@property
1397-
def x(self) -> List[int]: # E: Signature of "x" incompatible with supertype "A"
1396+
def x(self) -> List[int]:
13981397
return [123]
13991398
[builtins fixtures/list.pyi]
14001399
[out]

0 commit comments

Comments
 (0)