Skip to content

Commit 5d22e8d

Browse files
committed
no expectation of return type if there are call errors
1 parent 8a98eae commit 5d22e8d

File tree

9 files changed

+138
-152
lines changed

9 files changed

+138
-152
lines changed
Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,43 @@
11
conformant = "Partial"
22
notes = """
3-
Does not pick a winning overload based on arity, prior to considering argument types.
43
Does not expand boolean arguments to Literal[True] and Literal[False].
54
Does not expand enum arguments to literal variants.
65
Does not expand tuple arguments to possible combinations.
76
"""
87
conformance_automated = "Fail"
98
errors_diff = """
10-
Line 36: Unexpected errors ['overloads_evaluation.py:36: error: Expression is of type "Any", not "int" [assert-type]']
11-
Line 42: Unexpected errors ['overloads_evaluation.py:42: error: Expression is of type "Any", not "str" [assert-type]']
12-
Line 103: Unexpected errors ['overloads_evaluation.py:103: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]']
13-
Line 104: Unexpected errors ['overloads_evaluation.py:104: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]']
14-
Line 126: Unexpected errors ['overloads_evaluation.py:126: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]']
15-
Line 127: Unexpected errors ['overloads_evaluation.py:127: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]']
16-
Line 166: Unexpected errors ['overloads_evaluation.py:166: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]']
17-
Line 167: Unexpected errors ['overloads_evaluation.py:167: error: Expression is of type "int", not "int | str" [assert-type]']
9+
Line 106: Unexpected errors ['overloads_evaluation.py:106: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]']
10+
Line 107: Unexpected errors ['overloads_evaluation.py:107: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]']
11+
Line 129: Unexpected errors ['overloads_evaluation.py:129: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]']
12+
Line 130: Unexpected errors ['overloads_evaluation.py:130: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]']
13+
Line 169: Unexpected errors ['overloads_evaluation.py:169: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]']
14+
Line 170: Unexpected errors ['overloads_evaluation.py:170: error: Expression is of type "int", not "int | str" [assert-type]']
1815
"""
1916
output = """
20-
overloads_evaluation.py:27: error: All overload variants of "example1" require at least one argument [call-overload]
21-
overloads_evaluation.py:27: note: Possible overload variants:
22-
overloads_evaluation.py:27: note: def example1(x: int, y: str) -> int
23-
overloads_evaluation.py:27: note: def example1(x: str) -> str
24-
overloads_evaluation.py:35: error: No overload variant of "example1" matches argument types "int", "int" [call-overload]
25-
overloads_evaluation.py:35: note: Possible overload variants:
26-
overloads_evaluation.py:35: note: def example1(x: int, y: str) -> int
27-
overloads_evaluation.py:35: note: def example1(x: str) -> str
28-
overloads_evaluation.py:36: error: Expression is of type "Any", not "int" [assert-type]
29-
overloads_evaluation.py:41: error: No overload variant of "example1" matches argument type "int" [call-overload]
30-
overloads_evaluation.py:41: note: Possible overload variants:
31-
overloads_evaluation.py:41: note: def example1(x: int, y: str) -> int
32-
overloads_evaluation.py:41: note: def example1(x: str) -> str
33-
overloads_evaluation.py:42: error: Expression is of type "Any", not "str" [assert-type]
34-
overloads_evaluation.py:86: error: Argument 1 to "example2" has incompatible type "int | str"; expected "int" [arg-type]
35-
overloads_evaluation.py:86: error: Argument 2 to "example2" has incompatible type "int | str"; expected "str" [arg-type]
36-
overloads_evaluation.py:103: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]
37-
overloads_evaluation.py:103: note: Possible overload variants:
38-
overloads_evaluation.py:103: note: def expand_bool(x: Literal[False]) -> Literal[0]
39-
overloads_evaluation.py:103: note: def expand_bool(x: Literal[True]) -> Literal[1]
40-
overloads_evaluation.py:104: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]
41-
overloads_evaluation.py:126: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]
42-
overloads_evaluation.py:126: note: Possible overload variants:
43-
overloads_evaluation.py:126: note: def expand_enum(x: Literal[Color.RED]) -> Literal[0]
44-
overloads_evaluation.py:126: note: def expand_enum(x: Literal[Color.BLUE]) -> Literal[1]
45-
overloads_evaluation.py:127: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]
46-
overloads_evaluation.py:166: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]
47-
overloads_evaluation.py:167: error: Expression is of type "int", not "int | str" [assert-type]
17+
overloads_evaluation.py:32: error: All overload variants of "example1" require at least one argument [call-overload]
18+
overloads_evaluation.py:32: note: Possible overload variants:
19+
overloads_evaluation.py:32: note: def example1(x: int, y: str) -> int
20+
overloads_evaluation.py:32: note: def example1(x: str) -> str
21+
overloads_evaluation.py:40: error: No overload variant of "example1" matches argument types "int", "int" [call-overload]
22+
overloads_evaluation.py:40: note: Possible overload variants:
23+
overloads_evaluation.py:40: note: def example1(x: int, y: str) -> int
24+
overloads_evaluation.py:40: note: def example1(x: str) -> str
25+
overloads_evaluation.py:45: error: No overload variant of "example1" matches argument type "int" [call-overload]
26+
overloads_evaluation.py:45: note: Possible overload variants:
27+
overloads_evaluation.py:45: note: def example1(x: int, y: str) -> int
28+
overloads_evaluation.py:45: note: def example1(x: str) -> str
29+
overloads_evaluation.py:89: error: Argument 1 to "example2" has incompatible type "int | str"; expected "int" [arg-type]
30+
overloads_evaluation.py:89: error: Argument 2 to "example2" has incompatible type "int | str"; expected "str" [arg-type]
31+
overloads_evaluation.py:106: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]
32+
overloads_evaluation.py:106: note: Possible overload variants:
33+
overloads_evaluation.py:106: note: def expand_bool(x: Literal[False]) -> Literal[0]
34+
overloads_evaluation.py:106: note: def expand_bool(x: Literal[True]) -> Literal[1]
35+
overloads_evaluation.py:107: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]
36+
overloads_evaluation.py:129: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]
37+
overloads_evaluation.py:129: note: Possible overload variants:
38+
overloads_evaluation.py:129: note: def expand_enum(x: Literal[Color.RED]) -> Literal[0]
39+
overloads_evaluation.py:129: note: def expand_enum(x: Literal[Color.BLUE]) -> Literal[1]
40+
overloads_evaluation.py:130: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]
41+
overloads_evaluation.py:169: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]
42+
overloads_evaluation.py:170: error: Expression is of type "int", not "int | str" [assert-type]
4843
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "mypy 1.14.1"
2-
test_duration = 1.7
2+
test_duration = 1.8

conformance/results/pyre/overloads_evaluation.toml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,35 @@ Does not treat multiple matches due to gradual types as ambiguous.
99
"""
1010
conformance_automated = "Fail"
1111
errors_diff = """
12-
Line 78: Unexpected errors ['overloads_evaluation.py:78:23 Incompatible parameter type [6]: In call `example2`, for 2nd positional argument, expected `str` but got `Union[int, str]`.']
13-
Line 79: Unexpected errors ['overloads_evaluation.py:79:4 Assert type [70]: Expected `Union[int, str]` but got `str`.']
14-
Line 103: Unexpected errors ['overloads_evaluation.py:103:23 Incompatible parameter type [6]: In call `expand_bool`, for 1st positional argument, expected `typing_extensions.Literal[False]` but got `bool`.']
15-
Line 104: Unexpected errors ['overloads_evaluation.py:104:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.']
16-
Line 126: Unexpected errors ['overloads_evaluation.py:126:23 Incompatible parameter type [6]: In call `expand_enum`, for 1st positional argument, expected `typing_extensions.Literal[Color.RED]` but got `Color`.']
17-
Line 127: Unexpected errors ['overloads_evaluation.py:127:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.']
18-
Line 144: Unexpected errors ['overloads_evaluation.py:144:29 Incompatible parameter type [6]: In call `expand_type_union`, for 1st positional argument, expected `Type[int]` but got `Type[Union[int, str]]`.']
19-
Line 145: Unexpected errors ['overloads_evaluation.py:145:4 Assert type [70]: Expected `Union[int, str]` but got `int`.']
20-
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]]`.']
21-
Line 167: Unexpected errors ['overloads_evaluation.py:167:4 Assert type [70]: Expected `Union[int, str]` but got `int`.']
22-
Line 193: Unexpected errors ['overloads_evaluation.py:193:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[0]`.']
23-
Line 221: Unexpected errors ['overloads_evaluation.py:221:4 Assert type [70]: Expected `typing.Any` but got `int`.']
12+
Line 81: Unexpected errors ['overloads_evaluation.py:81:23 Incompatible parameter type [6]: In call `example2`, for 2nd positional argument, expected `str` but got `Union[int, str]`.']
13+
Line 82: Unexpected errors ['overloads_evaluation.py:82:4 Assert type [70]: Expected `Union[int, str]` but got `str`.']
14+
Line 106: Unexpected errors ['overloads_evaluation.py:106:23 Incompatible parameter type [6]: In call `expand_bool`, for 1st positional argument, expected `typing_extensions.Literal[False]` but got `bool`.']
15+
Line 107: Unexpected errors ['overloads_evaluation.py:107:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.']
16+
Line 129: Unexpected errors ['overloads_evaluation.py:129:23 Incompatible parameter type [6]: In call `expand_enum`, for 1st positional argument, expected `typing_extensions.Literal[Color.RED]` but got `Color`.']
17+
Line 130: Unexpected errors ['overloads_evaluation.py:130:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.']
18+
Line 147: Unexpected errors ['overloads_evaluation.py:147:29 Incompatible parameter type [6]: In call `expand_type_union`, for 1st positional argument, expected `Type[int]` but got `Type[Union[int, str]]`.']
19+
Line 148: Unexpected errors ['overloads_evaluation.py:148:4 Assert type [70]: Expected `Union[int, str]` but got `int`.']
20+
Line 169: Unexpected errors ['overloads_evaluation.py:169:24 Incompatible parameter type [6]: In call `expand_tuple`, for 1st positional argument, expected `Tuple[int, int]` but got `Tuple[int, Union[int, str]]`.']
21+
Line 170: Unexpected errors ['overloads_evaluation.py:170:4 Assert type [70]: Expected `Union[int, str]` but got `int`.']
22+
Line 196: Unexpected errors ['overloads_evaluation.py:196:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[0]`.']
23+
Line 224: Unexpected errors ['overloads_evaluation.py:224:4 Assert type [70]: Expected `typing.Any` but got `int`.']
2424
"""
2525
output = """
26-
overloads_evaluation.py:27:0 Missing argument [20]: Call `example1` expects argument `x`.
27-
overloads_evaluation.py:35:19 Incompatible parameter type [6]: In call `example1`, for 2nd positional argument, expected `str` but got `int`.
28-
overloads_evaluation.py:41:16 Incompatible parameter type [6]: In call `example1`, for 1st positional argument, expected `str` but got `int`.
29-
overloads_evaluation.py:78:23 Incompatible parameter type [6]: In call `example2`, for 2nd positional argument, expected `str` but got `Union[int, str]`.
30-
overloads_evaluation.py:79:4 Assert type [70]: Expected `Union[int, str]` but got `str`.
31-
overloads_evaluation.py:86:13 Incompatible parameter type [6]: In call `example2`, for 1st positional argument, expected `int` but got `Union[int, str]`.
32-
overloads_evaluation.py:86:16 Incompatible parameter type [6]: In call `example2`, for 2nd positional argument, expected `str` but got `Union[int, str]`.
33-
overloads_evaluation.py:103:23 Incompatible parameter type [6]: In call `expand_bool`, for 1st positional argument, expected `typing_extensions.Literal[False]` but got `bool`.
34-
overloads_evaluation.py:104:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.
35-
overloads_evaluation.py:126:23 Incompatible parameter type [6]: In call `expand_enum`, for 1st positional argument, expected `typing_extensions.Literal[Color.RED]` but got `Color`.
36-
overloads_evaluation.py:127:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.
37-
overloads_evaluation.py:144:29 Incompatible parameter type [6]: In call `expand_type_union`, for 1st positional argument, expected `Type[int]` but got `Type[Union[int, str]]`.
38-
overloads_evaluation.py:145:4 Assert type [70]: Expected `Union[int, str]` but got `int`.
39-
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]]`.
40-
overloads_evaluation.py:167:4 Assert type [70]: Expected `Union[int, str]` but got `int`.
41-
overloads_evaluation.py:193:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[0]`.
42-
overloads_evaluation.py:221:4 Assert type [70]: Expected `typing.Any` but got `int`.
26+
overloads_evaluation.py:32:0 Missing argument [20]: Call `example1` expects argument `x`.
27+
overloads_evaluation.py:40:12 Incompatible parameter type [6]: In call `example1`, for 2nd positional argument, expected `str` but got `int`.
28+
overloads_evaluation.py:45:9 Incompatible parameter type [6]: In call `example1`, for 1st positional argument, expected `str` but got `int`.
29+
overloads_evaluation.py:81:23 Incompatible parameter type [6]: In call `example2`, for 2nd positional argument, expected `str` but got `Union[int, str]`.
30+
overloads_evaluation.py:82:4 Assert type [70]: Expected `Union[int, str]` but got `str`.
31+
overloads_evaluation.py:89:13 Incompatible parameter type [6]: In call `example2`, for 1st positional argument, expected `int` but got `Union[int, str]`.
32+
overloads_evaluation.py:89:16 Incompatible parameter type [6]: In call `example2`, for 2nd positional argument, expected `str` but got `Union[int, str]`.
33+
overloads_evaluation.py:106:23 Incompatible parameter type [6]: In call `expand_bool`, for 1st positional argument, expected `typing_extensions.Literal[False]` but got `bool`.
34+
overloads_evaluation.py:107:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.
35+
overloads_evaluation.py:129:23 Incompatible parameter type [6]: In call `expand_enum`, for 1st positional argument, expected `typing_extensions.Literal[Color.RED]` but got `Color`.
36+
overloads_evaluation.py:130:4 Assert type [70]: Expected `Union[typing_extensions.Literal[0], typing_extensions.Literal[1]]` but got `typing_extensions.Literal[0]`.
37+
overloads_evaluation.py:147:29 Incompatible parameter type [6]: In call `expand_type_union`, for 1st positional argument, expected `Type[int]` but got `Type[Union[int, str]]`.
38+
overloads_evaluation.py:148:4 Assert type [70]: Expected `Union[int, str]` but got `int`.
39+
overloads_evaluation.py:169:24 Incompatible parameter type [6]: In call `expand_tuple`, for 1st positional argument, expected `Tuple[int, int]` but got `Tuple[int, Union[int, str]]`.
40+
overloads_evaluation.py:170:4 Assert type [70]: Expected `Union[int, str]` but got `int`.
41+
overloads_evaluation.py:196:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[0]`.
42+
overloads_evaluation.py:224:4 Assert type [70]: Expected `typing.Any` but got `int`.
4343
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pyre 0.9.23"
2-
test_duration = 6.1
2+
test_duration = 6.7

0 commit comments

Comments
 (0)