Skip to content

Commit 63224f2

Browse files
removed second overload
1 parent e708813 commit 63224f2

File tree

3 files changed

+0
-16
lines changed

3 files changed

+0
-16
lines changed

mypy/checkmember.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,19 +1448,6 @@ def analyze_typeddict_access(
14481448
)
14491449
overloads.append(overload)
14501450

1451-
# We add an extra overload for the case when the given default is a subtype of the value type.
1452-
# This makes sure that the return type is inferred as the value type instead of a union.
1453-
# def (K, V) -> V
1454-
overload = CallableType(
1455-
arg_types=[key_type, value_type],
1456-
arg_kinds=[ARG_POS, ARG_POS],
1457-
arg_names=[None, None],
1458-
ret_type=value_type,
1459-
fallback=fn_type,
1460-
name=name,
1461-
)
1462-
overloads.append(overload)
1463-
14641451
# fallback: def [T](K, T) -> V | T
14651452
overload = CallableType(
14661453
variables=[tvar],

test-data/unit/check-typeddict.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,6 @@ def test(d: D) -> None:
10111011
"Overload(\
10121012
def (Literal['a'], builtins.object =) -> builtins.int, \
10131013
def (Literal['b']) -> Union[builtins.str, None], \
1014-
def (Literal['b'], builtins.str) -> builtins.str, \
10151014
def [T] (Literal['b'], T`-1) -> Union[builtins.str, T`-1], \
10161015
def (builtins.str, builtins.object =) -> builtins.object)"
10171016

test-data/unit/pythoneval.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,8 @@ _testTypedDictGet.py:18: note: Revealed type is "builtins.object"
10681068
_testTypedDictGet.py:19: error: All overload variants of "get" require at least one argument
10691069
_testTypedDictGet.py:19: note: Possible overload variants:
10701070
_testTypedDictGet.py:19: note: def get(Literal['x'], /) -> Optional[int]
1071-
_testTypedDictGet.py:19: note: def get(Literal['x'], int, /) -> int
10721071
_testTypedDictGet.py:19: note: def [T] get(Literal['x'], T, /) -> Union[int, T]
10731072
_testTypedDictGet.py:19: note: def get(Literal['y'], /) -> Optional[str]
1074-
_testTypedDictGet.py:19: note: def get(Literal['y'], str, /) -> str
10751073
_testTypedDictGet.py:19: note: def [T] get(Literal['y'], T, /) -> Union[str, T]
10761074
_testTypedDictGet.py:19: note: def get(str, object = ..., /) -> object
10771075
_testTypedDictGet.py:21: note: Revealed type is "builtins.object"

0 commit comments

Comments
 (0)