File tree Expand file tree Collapse file tree 3 files changed +3
-2
lines changed Expand file tree Collapse file tree 3 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -4469,7 +4469,7 @@ def check_simple_assignment(
44694469 if (
44704470 isinstance (get_proper_type (lvalue_type ), UnionType )
44714471 # Skip literal types, as they have special logic (for better errors).
4472- and not isinstance ( get_proper_type ( rvalue_type ), LiteralType )
4472+ and not is_literal_type_like ( rvalue_type )
44734473 and not self .simple_rvalue (rvalue )
44744474 ):
44754475 # Try re-inferring r.h.s. in empty context, and use that if it
Original file line number Diff line number Diff line change @@ -2980,7 +2980,7 @@ class C(Base):
29802980 sep = "a" if int() else "b"
29812981 reveal_type(sep) # N: Revealed type is "Union[Literal['a'], Literal['b']]"
29822982 return super().feed_data(sep)
2983- [builtins fixtures/tuple .pyi]
2983+ [builtins fixtures/primitives .pyi]
29842984
29852985[case testLiteralInsideAType]
29862986from typing_extensions import Literal
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class int:
1919 def __init__ (self , x : object = ..., base : int = ...) -> None : pass
2020 def __add__ (self , i : int ) -> int : pass
2121 def __rmul__ (self , x : int ) -> int : pass
22+ def __bool__ (self ) -> bool : pass
2223class float :
2324 def __float__ (self ) -> float : pass
2425 def __add__ (self , x : float ) -> float : pass
You can’t perform that action at this time.
0 commit comments