diff --git a/conformance/results/mypy/specialtypes_never.toml b/conformance/results/mypy/specialtypes_never.toml index 7f54a2c5..d4640eb5 100644 --- a/conformance/results/mypy/specialtypes_never.toml +++ b/conformance/results/mypy/specialtypes_never.toml @@ -1,10 +1,10 @@ conformant = "Pass" output = """ specialtypes_never.py:19: error: Implicit return in function which does not return [misc] -specialtypes_never.py:87: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment] -specialtypes_never.py:87: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance -specialtypes_never.py:87: note: Consider using "Sequence" instead, which is covariant -specialtypes_never.py:106: error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value] +specialtypes_never.py:85: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment] +specialtypes_never.py:85: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance +specialtypes_never.py:85: note: Consider using "Sequence" instead, which is covariant +specialtypes_never.py:104: error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyrefly/specialtypes_never.toml b/conformance/results/pyrefly/specialtypes_never.toml index 5123b201..251ce6ae 100644 --- a/conformance/results/pyrefly/specialtypes_never.toml +++ b/conformance/results/pyrefly/specialtypes_never.toml @@ -1,14 +1,9 @@ -conformant = "Partial" -notes = """ -Does not detect invalid return is unreachable -""" -conformance_automated = "Fail" +conformant = "Pass" +conformance_automated = "Pass" errors_diff = """ -Line 33: Unexpected errors ["Returned type `Literal['whatever works']` is not assignable to declared return type `int` [bad-return]"] """ output = """ ERROR specialtypes_never.py:19:22-30: Function declared to return `NoReturn` but is missing an explicit `return` [bad-return] -ERROR specialtypes_never.py:33:12-28: Returned type `Literal['whatever works']` is not assignable to declared return type `int` [bad-return] -ERROR specialtypes_never.py:87:21-22: `list[Never]` is not assignable to `list[int]` [bad-assignment] -ERROR specialtypes_never.py:106:12-27: Returned type `ClassC[Never]` is not assignable to declared return type `ClassC[U]` [bad-return] +ERROR specialtypes_never.py:85:21-22: `list[Never]` is not assignable to `list[int]` [bad-assignment] +ERROR specialtypes_never.py:104:12-27: Returned type `ClassC[Never]` is not assignable to declared return type `ClassC[U]` [bad-return] """ diff --git a/conformance/results/pyright/specialtypes_never.toml b/conformance/results/pyright/specialtypes_never.toml index 250e0ed7..ad3d6a25 100644 --- a/conformance/results/pyright/specialtypes_never.toml +++ b/conformance/results/pyright/specialtypes_never.toml @@ -1,11 +1,11 @@ conformant = "Pass" output = """ specialtypes_never.py:19:22 - error: Function with declared return type "NoReturn" cannot return "None" (reportReturnType) -specialtypes_never.py:87:21 - error: Type "list[Never]" is not assignable to declared type "list[int]" +specialtypes_never.py:85:21 - error: Type "list[Never]" is not assignable to declared type "list[int]"   "list[Never]" is not assignable to "list[int]"     Type parameter "_T@list" is invariant, but "Never" is not the same as "int"     Consider switching from "list" to "Sequence" which is covariant (reportAssignmentType) -specialtypes_never.py:106:12 - error: Type "ClassC[Never]" is not assignable to return type "ClassC[U@func10]" +specialtypes_never.py:104:12 - error: Type "ClassC[Never]" is not assignable to return type "ClassC[U@func10]"   "ClassC[Never]" is not assignable to "ClassC[U@func10]"     Type parameter "T@ClassC" is invariant, but "Never" is not the same as "U@func10" (reportReturnType) """ diff --git a/conformance/results/results.html b/conformance/results/results.html index 7d93ea31..72964529 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -227,7 +227,7 @@

Python Type System Conformance Test Results

Pass Pass Pass -
Partial

Does not detect invalid return is unreachable

+Pass      specialtypes_none Pass diff --git a/conformance/results/zuban/specialtypes_never.toml b/conformance/results/zuban/specialtypes_never.toml index efd39676..d65bc2c9 100644 --- a/conformance/results/zuban/specialtypes_never.toml +++ b/conformance/results/zuban/specialtypes_never.toml @@ -3,9 +3,8 @@ errors_diff = """ """ output = """ specialtypes_never.py:19: error: Implicit return in function which does not return [misc] -specialtypes_never.py:32: error: Statement is unreachable [unreachable] -specialtypes_never.py:87: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment] -specialtypes_never.py:87: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance -specialtypes_never.py:87: note: Consider using "Sequence" instead, which is covariant -specialtypes_never.py:106: error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value] +specialtypes_never.py:85: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment] +specialtypes_never.py:85: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance +specialtypes_never.py:85: note: Consider using "Sequence" instead, which is covariant +specialtypes_never.py:104: error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value] """ diff --git a/conformance/tests/specialtypes_never.py b/conformance/tests/specialtypes_never.py index 6d8adb92..a3ffb4cc 100644 --- a/conformance/tests/specialtypes_never.py +++ b/conformance/tests/specialtypes_never.py @@ -24,13 +24,11 @@ def func1(x: int) -> NoReturn: # E: implicitly returns None # > The checkers will also recognize that the code after calls to such functions # > is unreachable and will behave accordingly. - +# No error on implicit None return after stop() def func2(x: int) -> int: if x > 0: return x stop() - ... # E?: This statement can be marked unreachable - return "whatever works" # No type error # The spec previously said that NoReturn is only valid in a function return type,