File tree Expand file tree Collapse file tree 6 files changed +16
-24
lines changed
Expand file tree Collapse file tree 6 files changed +16
-24
lines changed Original file line number Diff line number Diff line change 11conformant = " Pass"
22output = """
33specialtypes_never.py:19: error: Implicit return in function which does not return [misc]
4- specialtypes_never.py:87 : error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment]
5- specialtypes_never.py:87 : note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
6- specialtypes_never.py:87 : note: Consider using "Sequence" instead, which is covariant
7- specialtypes_never.py:106 : error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value]
4+ specialtypes_never.py:85 : error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment]
5+ specialtypes_never.py:85 : note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
6+ specialtypes_never.py:85 : note: Consider using "Sequence" instead, which is covariant
7+ specialtypes_never.py:104 : error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value]
88"""
99conformance_automated = " Pass"
1010errors_diff = """
Original file line number Diff line number Diff line change 1- conformant = " Partial"
2- notes = """
3- Does not detect invalid return is unreachable
4- """
5- conformance_automated = " Fail"
1+ conformant = " Pass"
2+ conformance_automated = " Pass"
63errors_diff = """
7- Line 33: Unexpected errors ["Returned type `Literal['whatever works']` is not assignable to declared return type `int` [bad-return]"]
84"""
95output = """
106ERROR specialtypes_never.py:19:22-30: Function declared to return `NoReturn` but is missing an explicit `return` [bad-return]
11- ERROR specialtypes_never.py:33:12-28: Returned type `Literal['whatever works']` is not assignable to declared return type `int` [bad-return]
12- ERROR specialtypes_never.py:87:21-22: `list[Never]` is not assignable to `list[int]` [bad-assignment]
13- ERROR specialtypes_never.py:106:12-27: Returned type `ClassC[Never]` is not assignable to declared return type `ClassC[U]` [bad-return]
7+ ERROR specialtypes_never.py:85:21-22: `list[Never]` is not assignable to `list[int]` [bad-assignment]
8+ ERROR specialtypes_never.py:104:12-27: Returned type `ClassC[Never]` is not assignable to declared return type `ClassC[U]` [bad-return]
149"""
Original file line number Diff line number Diff line change 11conformant = " Pass"
22output = """
33specialtypes_never.py:19:22 - error: Function with declared return type "NoReturn" cannot return "None" (reportReturnType)
4- specialtypes_never.py:87 :21 - error: Type "list[Never]" is not assignable to declared type "list[int]"
4+ specialtypes_never.py:85 :21 - error: Type "list[Never]" is not assignable to declared type "list[int]"
55 "list[Never]" is not assignable to "list[int]"
66 Type parameter "_T@list" is invariant, but "Never" is not the same as "int"
77 Consider switching from "list" to "Sequence" which is covariant (reportAssignmentType)
8- specialtypes_never.py:106 :12 - error: Type "ClassC[Never]" is not assignable to return type "ClassC[U@func10]"
8+ specialtypes_never.py:104 :12 - error: Type "ClassC[Never]" is not assignable to return type "ClassC[U@func10]"
99 "ClassC[Never]" is not assignable to "ClassC[U@func10]"
1010 Type parameter "T@ClassC" is invariant, but "Never" is not the same as "U@func10" (reportReturnType)
1111"""
Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ <h3>Python Type System Conformance Test Results</h3>
227227< th class ="column col2 conformant "> Pass</ th >
228228< th class ="column col2 conformant "> Pass</ th >
229229< th class ="column col2 conformant "> Pass</ th >
230- < th class ="column col2 partially- conformant "> < div class =" hover-text " > Partial < span class =" tooltip-text " id =" bottom " > < p > Does not detect invalid return is unreachable </ p > </ span > </ div > </ th >
230+ < th class ="column col2 conformant "> Pass </ th >
231231</ tr >
232232< tr > < th class ="column col1 "> specialtypes_none</ th >
233233< th class ="column col2 conformant "> Pass</ th >
Original file line number Diff line number Diff line change @@ -3,9 +3,8 @@ errors_diff = """
33"""
44output = """
55specialtypes_never.py:19: error: Implicit return in function which does not return [misc]
6- specialtypes_never.py:32: error: Statement is unreachable [unreachable]
7- specialtypes_never.py:87: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment]
8- specialtypes_never.py:87: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
9- specialtypes_never.py:87: note: Consider using "Sequence" instead, which is covariant
10- specialtypes_never.py:106: error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value]
6+ specialtypes_never.py:85: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment]
7+ specialtypes_never.py:85: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
8+ specialtypes_never.py:85: note: Consider using "Sequence" instead, which is covariant
9+ specialtypes_never.py:104: error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value]
1110"""
Original file line number Diff line number Diff line change @@ -24,13 +24,11 @@ def func1(x: int) -> NoReturn: # E: implicitly returns None
2424# > The checkers will also recognize that the code after calls to such functions
2525# > is unreachable and will behave accordingly.
2626
27-
27+ # No error on implicit None return after stop()
2828def func2 (x : int ) -> int :
2929 if x > 0 :
3030 return x
3131 stop ()
32- ... # E?: This statement can be marked unreachable
33- return "whatever works" # No type error
3432
3533
3634# The spec previously said that NoReturn is only valid in a function return type,
You can’t perform that action at this time.
0 commit comments