diff --git a/docs/spec/overload.rst b/docs/spec/overload.rst index 5e346f2e..7c298135 100644 --- a/docs/spec/overload.rst +++ b/docs/spec/overload.rst @@ -158,7 +158,7 @@ should report an error:: def func(x: str, /) -> str: ... @overload def func(x: int) -> int: ... - + # This implementation is inconsistent with the second overload # because it does not accept a keyword argument ``x`` and the # the overload's return type ``int`` is not assignable to the @@ -169,7 +169,7 @@ should report an error:: Overlapping overloads ^^^^^^^^^^^^^^^^^^^^^ -If two overloads can accept the same set of arguments but have +If two overloads can accept the same set of arguments but have different return types, the overloads are said to "partially overlap". This condition is indicative of a programming error and should be reported by type checkers:: @@ -184,7 +184,7 @@ be reported by type checkers:: def func(x: int) -> str: ... If all arguments accepted by an overload are also always accepted by -an earlier overload, the two overloads are said to "fully overlap". +an earlier overload, the two overloads are said to "fully overlap". In this case, the latter overload will never be used. This condition is indicative of a programming error and should be reported by type checkers:: @@ -355,7 +355,7 @@ Example 3:: def example3(x: int, y: int) -> tuple[int, int]: ... @overload def example3(*args: int) -> tuple[int, ...]: ... - + def test(): # Step 1 eliminates second overload. Step 4 and # step 5 do not apply. Step 6 picks the first