@@ -196,8 +196,10 @@ Only the overloads (the ``@overload``-decorated signatures) should be
196196considered for matching purposes. The implementation, if provided,
197197should be ignored for purposes of overload matching.
198198
199+ Step 1
200+ ~~~~~~
199201
200- Step 1: Examine the argument list to determine the number of
202+ Examine the argument list to determine the number of
201203positional and keyword arguments. Use this information to eliminate any
202204overload candidates that are not plausible based on their
203205input signatures.
@@ -207,8 +209,10 @@ input signatures.
207209 it as if it were a non-overloaded function call and stop.
208210- If two or more candidate overloads remain, proceed to step 2.
209211
212+ Step 2
213+ ~~~~~~
210214
211- Step 2: Evaluate each remaining overload as a regular (non-overloaded)
215+ Evaluate each remaining overload as a regular (non-overloaded)
212216call to determine whether it is compatible with the supplied
213217argument list. Unlike step 1, this step considers the types of the parameters
214218and arguments. During this step, do not generate any user-visible errors.
@@ -219,8 +223,10 @@ Simply record which of the overloads result in evaluation errors.
219223 Evaluate it as if it were a non-overloaded function call and stop.
220224- If two or more candidate overloads remain, proceed to step 4.
221225
226+ Step 3
227+ ~~~~~~
222228
223- Step 3: If step 2 produces errors for all overloads, perform
229+ If step 2 produces errors for all overloads, perform
224230"argument type expansion". Union types can be expanded
225231into their constituent subtypes. For example, the type ``int | str `` can
226232be expanded into ``int `` and ``str ``.
@@ -248,8 +254,10 @@ expanded argument lists.
248254For additional details about argument type expansion, see
249255`argument-type-expansion `_ below.
250256
257+ Step 4
258+ ~~~~~~
251259
252- Step 4: If the argument list is compatible with two or more overloads,
260+ If the argument list is compatible with two or more overloads,
253261determine whether one or more of the overloads has a variadic parameter
254262(either ``*args `` or ``**kwargs ``) that maps to a corresponding argument
255263that supplies an indeterminate number of positional or keyword arguments.
@@ -260,8 +268,10 @@ If so, eliminate overloads that do not have a variadic parameter.
260268 call and stop.
261269- If two or more candidate overloads remain, proceed to step 5.
262270
271+ Step 5
272+ ~~~~~~
263273
264- Step 5: For all arguments, determine whether all possible
274+ For all arguments, determine whether all possible
265275:term: `materializations <materialize> ` of the argument's type are assignable to
266276the corresponding parameter type for each of the remaining overloads. If so,
267277eliminate all of the subsequent remaining overloads.
@@ -295,8 +305,10 @@ for all remaining overloads are :term:`equivalent`, proceed to step 6.
295305If the return types are not equivalent, overload matching is ambiguous. In
296306this case, assume a return type of ``Any `` and stop.
297307
308+ Step 6
309+ ~~~~~~
298310
299- Step 6: Choose the first remaining candidate overload as the winning
311+ Choose the first remaining candidate overload as the winning
300312match. Evaluate it as if it were a non-overloaded function call and stop.
301313
302314Example 1::
0 commit comments