diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 1012f096b..9e6527ca3 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.14.1" -test_duration = 1.7 +test_duration = 1.8 diff --git a/conformance/results/pyre/overloads_evaluation.toml b/conformance/results/pyre/overloads_evaluation.toml index 79dfb530d..ef2abadb4 100644 --- a/conformance/results/pyre/overloads_evaluation.toml +++ b/conformance/results/pyre/overloads_evaluation.toml @@ -4,6 +4,7 @@ Does not expand boolean arguments to Literal[True] and Literal[False]. Does not expand enum arguments to literal variants. Does not expand type[A | B] to type[A] and type[B]. Does not expand tuple arguments to possible combinations. +Does not prefer variadic match to indeterminate-length unpacked argument. """ conformance_automated = "Fail" errors_diff = """ @@ -17,6 +18,7 @@ Line 144: Unexpected errors ['overloads_evaluation.py:144:29 Incompatible parame Line 145: Unexpected errors ['overloads_evaluation.py:145:4 Assert type [70]: Expected `Union[int, str]` but got `int`.'] Line 166: Unexpected errors ['overloads_evaluation.py:166:24 Incompatible parameter type [6]: In call `expand_tuple`, for 1st positional argument, expected `Tuple[int, int]` but got `Tuple[int, Union[int, str]]`.'] Line 167: Unexpected errors ['overloads_evaluation.py:167:4 Assert type [70]: Expected `Union[int, str]` but got `int`.'] +Line 193: Unexpected errors ['overloads_evaluation.py:193:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[0]`.'] """ output = """ overloads_evaluation.py:27:0 Missing argument [20]: Call `example1` expects argument `x`. @@ -34,4 +36,5 @@ overloads_evaluation.py:144:29 Incompatible parameter type [6]: In call `expand_ overloads_evaluation.py:145:4 Assert type [70]: Expected `Union[int, str]` but got `int`. overloads_evaluation.py:166:24 Incompatible parameter type [6]: In call `expand_tuple`, for 1st positional argument, expected `Tuple[int, int]` but got `Tuple[int, Union[int, str]]`. overloads_evaluation.py:167:4 Assert type [70]: Expected `Union[int, str]` but got `int`. +overloads_evaluation.py:193:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[0]`. """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index e22b34fde..2904f5c8d 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.23" -test_duration = 5.9 +test_duration = 6.0 diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 1ae5a35b8..eef86e05d 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.391" -test_duration = 1.5 +test_duration = 1.6 diff --git a/conformance/results/pytype/overloads_evaluation.toml b/conformance/results/pytype/overloads_evaluation.toml index 10f0f1633..917b44615 100644 --- a/conformance/results/pytype/overloads_evaluation.toml +++ b/conformance/results/pytype/overloads_evaluation.toml @@ -21,6 +21,7 @@ Line 141: Unexpected errors ['overloads_evaluation.py:141:12: \\x1b[1m\\x1b[31me Line 145: Unexpected errors ['overloads_evaluation.py:145:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in check_expand_type_union: int [assert-type]'] Line 163: Unexpected errors ['overloads_evaluation.py:163:12: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in expand_tuple: bad return type [bad-return-type]'] Line 167: Unexpected errors ['overloads_evaluation.py:167:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in check_expand_tuple: int [assert-type]'] +Line 185: Unexpected errors ['overloads_evaluation.py:185:12: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in variadic: bad return type [bad-return-type]'] """ output = """ overloads_evaluation.py:23:12: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in example1: bad return type [bad-return-type] @@ -120,4 +121,9 @@ overloads_evaluation.py:167:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in c assert_type(ret1, int | str) \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m +overloads_evaluation.py:185:12: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in variadic: bad return type [bad-return-type] + + return 1 + \u001b[1m\u001b[31m~\u001b[39m\u001b[0m + """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 5c9832314..ab86ac892 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.10.11" -test_duration = 31.0 +test_duration = 31.2 diff --git a/conformance/results/results.html b/conformance/results/results.html index d1d5a0376..c039dd235 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

- + diff --git a/conformance/tests/overloads_evaluation.py b/conformance/tests/overloads_evaluation.py index f73c27fd1..76150923f 100644 --- a/conformance/tests/overloads_evaluation.py +++ b/conformance/tests/overloads_evaluation.py @@ -166,3 +166,28 @@ def check_expand_tuple(v: int | str) -> None: ret1 = expand_tuple((1, v)) assert_type(ret1, int | str) + +# > Step 4: If the argument list is compatible with two or more overloads, +# > determine whether one or more of the overloads has a variadic parameter +# > (either ``*args`` or ``**kwargs``) that maps to a corresponding argument +# > that supplies an indeterminate number of positional or keyword arguments. +# > If so, eliminate overloads that do not have a variadic parameter. + +@overload +def variadic(x: int, /) -> Literal[0]: + ... + +@overload +def variadic(*args: int) -> int: + ... + +def variadic(*args: int) -> int | str: + return 1 + +# > - If this results in only one remaining candidate overload, it is +# > the winning match. Evaluate it as if it were a non-overloaded function +# > call and stop. + +def check_variadic(v: list[int]) -> None: + ret1 = variadic(*v) + assert_type(ret1, int)
 
mypy 1.14.1
-
1.7sec
+
1.8sec
pyright 1.1.391
-
1.5sec
+
1.6sec
pyre 0.9.23
-
5.9sec
+
6.0sec
pytype 2024.10.11
-
31.0sec
+
31.2sec
@@ -693,7 +693,7 @@

Python Type System Conformance Test Results

     overloads_evaluation
Partial

Does not pick a winning overload based on arity, prior to considering argument types.

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand tuple arguments to possible combinations.

Partial

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand tuple arguments to possible combinations.

Partial

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand type[A | B] to type[A] and type[B].

Does not expand tuple arguments to possible combinations.

Partial

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand type[A | B] to type[A] and type[B].

Does not expand tuple arguments to possible combinations.

Does not prefer variadic match to indeterminate-length unpacked argument.

Partial

Does not pick a winning overload based on arity, prior to considering argument types.

Does not perform argument expansion (on any types) when matching overloads.

     overloads_overlap