You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reveal_type(self.__x) # N: Revealed type is "builtins.int"
8480
-
reveal_type(self._A__x) # N: Revealed type is "builtins.int"
8481
-
reveal_type(self.__y) # N: Revealed type is "builtins.int"
8482
-
reveal_type(self._A__y) # N: Revealed type is "builtins.int"
8483
-
reveal_type(self.__z) # N: Revealed type is "builtins.int"
8484
-
reveal_type(self._A__z) # N: Revealed type is "builtins.int"
8485
-
8486
-
def set(self) -> None:
8487
-
self.__x = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int")
8488
-
self._A__x = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int")
8489
-
self.__y += "" # E: Unsupported operand types for + ("int" and "str")
8490
-
self._A__y += "" # E: Unsupported operand types for + ("int" and "str")
8491
-
self.__z = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int")
8492
-
self._A__z = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int")
8493
-
8494
-
class B(A):
8495
-
__x: str
8496
-
8497
-
def __init__(self) -> None:
8498
-
self.__y: str
8499
-
self._A__z: str # E: Incompatible types in assignment (expression has type "str", base class "A" defined the type as "int")
8500
-
8501
-
def get(self) -> None:
8502
-
reveal_type(self.__x) # N: Revealed type is "builtins.str"
8503
-
reveal_type(self._A__x) # N: Revealed type is "builtins.int"
8504
-
reveal_type(self._B__x) # N: Revealed type is "builtins.str"
8505
-
reveal_type(self.__y) # N: Revealed type is "builtins.str"
8506
-
reveal_type(self._A__y) # N: Revealed type is "builtins.int"
8507
-
reveal_type(self._B__y) # N: Revealed type is "builtins.str"
8508
-
self.__z # E: "B" has no attribute "_B__z"; maybe "_A__z", "_B__x", or "_B__y"?
8509
-
reveal_type(self._A__z) # N: Revealed type is "builtins.str"
8510
-
self._B__z # E: "B" has no attribute "_B__z"; maybe "_A__z", "_B__x", or "_B__y"?
8511
-
8512
-
[case testNameManglingMethod]
8513
-
8514
-
class A:
8515
-
8516
-
def __f(self) -> int:
8517
-
...
8518
-
8519
-
def g(self) -> None:
8520
-
reveal_type(self.__f()) # N: Revealed type is "builtins.int"
8521
-
reveal_type(self._A__f()) # N: Revealed type is "builtins.int"
8522
-
8523
-
async def __h(self) -> int:
8524
-
...
8525
-
8526
-
async def i(self) -> None:
8527
-
await reveal_type(self.__h()) # N: Revealed type is "typing.Coroutine[Any, Any, builtins.int]"
8528
-
await reveal_type(self._A__h()) # N: Revealed type is "typing.Coroutine[Any, Any, builtins.int]"
8529
-
8530
-
class B(A):
8531
-
8532
-
def j(self) -> None:
8533
-
reveal_type(self._A__f()) # N: Revealed type is "builtins.int"
8534
-
self.__f() # E: "B" has no attribute "_B__f"; maybe "_A__f"?
8535
-
self._B__f() # E: "B" has no attribute "_B__f"; maybe "_A__f"?
8536
-
8537
-
async def k(self) -> None:
8538
-
await reveal_type(self._A__h()) # N: Revealed type is "typing.Coroutine[Any, Any, builtins.int]"
8539
-
self.__h() # E: "B" has no attribute "_B__h"; maybe "_A__h"?
8540
-
self._B__h() # E: "B" has no attribute "_B__h"; maybe "_A__h"?
8541
-
8542
-
class C(B):
8543
-
8544
-
def __f(self) -> str:
8545
-
...
8546
-
8547
-
def _A__f(self) -> str: # E: Return type "str" of "_A__f" incompatible with return type "int" in supertype "A"
8548
-
...
8549
-
8550
-
async def __h(self) -> str:
8551
-
...
8552
-
8553
-
async def _A__h(self) -> str: # E: Return type "Coroutine[Any, Any, str]" of "_A__h" incompatible with return type "Coroutine[Any, Any, int]" in supertype "A"
0 commit comments