diff --git a/conformance/README.md b/conformance/README.md index 0b60a9490..8c51f521d 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -91,6 +91,32 @@ To add a new test, create a new ".py" file in the `tests` directory. Its name mu If a test is updated (augmented or fixed), the process is similar to when adding a new test. Run the conformance test tool to generate new results and manually examine the output of each supported type checker. Then update the conformance status accordingly. Once the conformance status has been updated, rerun the conformance test tool to regenerate the summary report. +## Version and Platform Checking Tests + +The version and implementation checks use the suite's Python 3.12 CPython target, +with no implementation override. Tests cover both reachable and unreachable +branches: intentional errors in reachable branches must be reported, errors in +unreachable branches must be suppressed, and `assert_type` checks verify branch +selection. Existing three-element version comparisons and `os.name` checks remain +optional; tuple, set, and list membership checks are required. + +Platform tests use nonexistent platform names for portable nonmatches and guard +positive Linux membership checks with `sys.platform == "linux"`. Tagged errors in +the outer `else` branch keep the expectations valid on non-Linux targets. Run on a +Linux target to exercise the positive membership cases. Prefix checks include the +empty prefix (always a match) and a nonexistent prefix (never a match). A guarded +`freebsd13` scenario tests a matching `freebsd` prefix and a nonmatching `linux` +prefix; run with a `freebsd13` target to exercise these branches. + +The ordinary suite does not validate all target configuration mechanisms. Separate +targeted runs are needed for Windows/Linux selection, the versioned FreeBSD +scenario, and non-CPython implementation versions distinct from the language version. +The current runner has no target-scenario matrix, and the checker CLIs examined +for this change expose language-version/platform options but no implementation-name +or implementation-version options. Non-CPython configuration coverage is therefore +deferred until suitable checker support is available; missing implementation-check +support is still recorded in the ordinary conformance results. + ## Updating a Type Checker Type checker versions are locked in `uv.lock`. diff --git a/conformance/results/mypy/directives_implementation_name.toml b/conformance/results/mypy/directives_implementation_name.toml new file mode 100644 index 000000000..595690e5f --- /dev/null +++ b/conformance/results/mypy/directives_implementation_name.toml @@ -0,0 +1,74 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.name equality or membership checks. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_name.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 23: Unexpected errors ['directives_implementation_name.py:23: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 27: Unexpected errors ['directives_implementation_name.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 32: Unexpected errors ['directives_implementation_name.py:32: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 36: Unexpected errors ['directives_implementation_name.py:36: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 42: Unexpected errors ['directives_implementation_name.py:42: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 44: Unexpected errors ['directives_implementation_name.py:44: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 54: Unexpected errors ['directives_implementation_name.py:54: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 56: Unexpected errors ['directives_implementation_name.py:56: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 60: Unexpected errors ['directives_implementation_name.py:60: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 65: Unexpected errors ['directives_implementation_name.py:65: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 68: Unexpected errors ['directives_implementation_name.py:68: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 74: Unexpected errors ['directives_implementation_name.py:74: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 84: Unexpected errors ['directives_implementation_name.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 86: Unexpected errors ['directives_implementation_name.py:86: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 90: Unexpected errors ['directives_implementation_name.py:90: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 95: Unexpected errors ['directives_implementation_name.py:95: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 98: Unexpected errors ['directives_implementation_name.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 104: Unexpected errors ['directives_implementation_name.py:104: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 114: Unexpected errors ['directives_implementation_name.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 116: Unexpected errors ['directives_implementation_name.py:116: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 120: Unexpected errors ['directives_implementation_name.py:120: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 125: Unexpected errors ['directives_implementation_name.py:125: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 128: Unexpected errors ['directives_implementation_name.py:128: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 134: Unexpected errors ['directives_implementation_name.py:134: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_implementation_name.py:18: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:23: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:30: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:32: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:36: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:39: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:42: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:44: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:51: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:54: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:56: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:60: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:63: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:65: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:68: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:70: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:72: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:74: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:81: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:86: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:90: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:93: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:95: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:100: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:102: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:104: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:111: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:116: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:120: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:123: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:125: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_name.py:128: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:130: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:132: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:134: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/mypy/directives_implementation_version.toml b/conformance/results/mypy/directives_implementation_version.toml new file mode 100644 index 000000000..ba532781e --- /dev/null +++ b/conformance/results/mypy/directives_implementation_version.toml @@ -0,0 +1,25 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.version comparisons using the CPython target version. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_version.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 23: Unexpected errors ['directives_implementation_version.py:23: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 27: Unexpected errors ['directives_implementation_version.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 32: Unexpected errors ['directives_implementation_version.py:32: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 37: Unexpected errors ['directives_implementation_version.py:37: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 39: Unexpected errors ['directives_implementation_version.py:39: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_implementation_version.py:18: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:23: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_version.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:30: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:32: error: Expression is of type "int | str", not "int" [assert-type] +directives_implementation_version.py:35: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:37: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:39: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:41: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/mypy/directives_platform_checks.toml b/conformance/results/mypy/directives_platform_checks.toml new file mode 100644 index 000000000..df27a0a43 --- /dev/null +++ b/conformance/results/mypy/directives_platform_checks.toml @@ -0,0 +1,63 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for tuple, set, or list membership and nonmembership checks. +""" +errors_diff = """ +Line 75: Unexpected errors ['directives_platform_checks.py:75: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 80: Unexpected errors ['directives_platform_checks.py:80: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 87: Unexpected errors ['directives_platform_checks.py:87: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 89: Unexpected errors ['directives_platform_checks.py:89: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 96: Unexpected errors ['directives_platform_checks.py:96: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 98: Unexpected errors ['directives_platform_checks.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 110: Unexpected errors ['directives_platform_checks.py:110: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 115: Unexpected errors ['directives_platform_checks.py:115: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 122: Unexpected errors ['directives_platform_checks.py:122: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 124: Unexpected errors ['directives_platform_checks.py:124: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 130: Unexpected errors ['directives_platform_checks.py:130: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 132: Unexpected errors ['directives_platform_checks.py:132: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 144: Unexpected errors ['directives_platform_checks.py:144: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 149: Unexpected errors ['directives_platform_checks.py:149: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 156: Unexpected errors ['directives_platform_checks.py:156: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 158: Unexpected errors ['directives_platform_checks.py:158: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 164: Unexpected errors ['directives_platform_checks.py:164: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 166: Unexpected errors ['directives_platform_checks.py:166: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_platform_checks.py:18: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:24: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:36: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:48: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:65: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:66: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:75: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:78: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:80: error: Expression is of type "int | str", not "int" [assert-type] +directives_platform_checks.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:87: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:89: error: Expression is of type "int | str", not "int" [assert-type] +directives_platform_checks.py:94: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:96: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:100: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:110: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:113: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:115: error: Expression is of type "int | str", not "int" [assert-type] +directives_platform_checks.py:119: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:122: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:124: error: Expression is of type "int | str", not "int" [assert-type] +directives_platform_checks.py:128: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:130: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:132: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:134: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:144: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:147: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:149: error: Expression is of type "int | str", not "int" [assert-type] +directives_platform_checks.py:153: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:156: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:158: error: Expression is of type "int | str", not "int" [assert-type] +directives_platform_checks.py:162: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:164: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:166: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:168: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/mypy/directives_version_platform.toml b/conformance/results/mypy/directives_version_platform.toml index 80c6eecff..e58a1916f 100644 --- a/conformance/results/mypy/directives_version_platform.toml +++ b/conformance/results/mypy/directives_version_platform.toml @@ -9,6 +9,9 @@ directives_version_platform.py:33: error: Name "val3" is not defined; did you me directives_version_platform.py:42: error: Expression is of type "int | str", not "int" [assert-type] directives_version_platform.py:50: error: Name "val6" is not defined [name-defined] directives_version_platform.py:59: error: Name "val9" is not defined [name-defined] +directives_version_platform.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform.py:96: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform.py:111: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/directives_version_platform_boolean.toml b/conformance/results/mypy/directives_version_platform_boolean.toml new file mode 100644 index 000000000..4a3aae5f8 --- /dev/null +++ b/conformance/results/mypy/directives_version_platform_boolean.toml @@ -0,0 +1,36 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for negated platform membership or combinations involving implementation checks. +""" +errors_diff = """ +Line 32: Unexpected errors ['directives_version_platform_boolean.py:32: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 115: Unexpected errors ['directives_version_platform_boolean.py:115: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 118: Unexpected errors ['directives_version_platform_boolean.py:118: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 120: Unexpected errors ['directives_version_platform_boolean.py:120: error: Expression is of type "int | str", not "int" [assert-type]'] +Line 123: Unexpected errors ['directives_version_platform_boolean.py:123: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 129: Unexpected errors ['directives_version_platform_boolean.py:129: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_version_platform_boolean.py:17: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:30: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:32: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:40: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:50: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:54: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:58: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:68: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:73: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:77: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:81: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:95: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:110: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:115: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:118: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:120: error: Expression is of type "int | str", not "int" [assert-type] +directives_version_platform_boolean.py:123: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:125: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:129: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:131: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/pycroscope/directives_implementation_name.toml b/conformance/results/pycroscope/directives_implementation_name.toml new file mode 100644 index 000000000..3656c2c8e --- /dev/null +++ b/conformance/results/pycroscope/directives_implementation_name.toml @@ -0,0 +1,74 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.name equality or membership checks. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ["./directives_implementation_name.py:21:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 23: Unexpected errors ['./directives_implementation_name.py:23:16: int | str is not equivalent to int'] +Line 27: Unexpected errors ["./directives_implementation_name.py:27:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 32: Unexpected errors ['./directives_implementation_name.py:32:16: str | int is not equivalent to int'] +Line 36: Unexpected errors ["./directives_implementation_name.py:36:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 42: Unexpected errors ["./directives_implementation_name.py:42:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 44: Unexpected errors ['./directives_implementation_name.py:44:16: str | int is not equivalent to int'] +Line 54: Unexpected errors ["./directives_implementation_name.py:54:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 56: Unexpected errors ['./directives_implementation_name.py:56:16: int | str is not equivalent to int'] +Line 60: Unexpected errors ["./directives_implementation_name.py:60:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 65: Unexpected errors ['./directives_implementation_name.py:65:16: str | int is not equivalent to int'] +Line 68: Unexpected errors ["./directives_implementation_name.py:68:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 74: Unexpected errors ["./directives_implementation_name.py:74:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 84: Unexpected errors ["./directives_implementation_name.py:84:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 86: Unexpected errors ['./directives_implementation_name.py:86:16: int | str is not equivalent to int'] +Line 90: Unexpected errors ["./directives_implementation_name.py:90:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 95: Unexpected errors ['./directives_implementation_name.py:95:16: str | int is not equivalent to int'] +Line 98: Unexpected errors ["./directives_implementation_name.py:98:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 104: Unexpected errors ["./directives_implementation_name.py:104:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 114: Unexpected errors ["./directives_implementation_name.py:114:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 116: Unexpected errors ['./directives_implementation_name.py:116:16: int | str is not equivalent to int'] +Line 120: Unexpected errors ["./directives_implementation_name.py:120:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 125: Unexpected errors ['./directives_implementation_name.py:125:16: str | int is not equivalent to int'] +Line 128: Unexpected errors ["./directives_implementation_name.py:128:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 134: Unexpected errors ["./directives_implementation_name.py:134:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +""" +output = """ +./directives_implementation_name.py:18:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:21:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:23:16: int | str is not equivalent to int +./directives_implementation_name.py:27:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:30:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:32:16: str | int is not equivalent to int +./directives_implementation_name.py:36:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:39:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:42:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:44:16: str | int is not equivalent to int +./directives_implementation_name.py:51:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:54:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:56:16: int | str is not equivalent to int +./directives_implementation_name.py:60:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:63:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:65:16: str | int is not equivalent to int +./directives_implementation_name.py:68:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:70:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:72:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:74:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:81:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:84:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:86:16: int | str is not equivalent to int +./directives_implementation_name.py:90:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:93:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:95:16: str | int is not equivalent to int +./directives_implementation_name.py:98:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:100:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:102:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:104:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:111:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:114:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:116:16: int | str is not equivalent to int +./directives_implementation_name.py:120:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:123:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:125:16: str | int is not equivalent to int +./directives_implementation_name.py:128:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_name.py:130:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:132:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_name.py:134:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +""" diff --git a/conformance/results/pycroscope/directives_implementation_version.toml b/conformance/results/pycroscope/directives_implementation_version.toml new file mode 100644 index 000000000..9905857c1 --- /dev/null +++ b/conformance/results/pycroscope/directives_implementation_version.toml @@ -0,0 +1,25 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.version comparisons using the CPython target version. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ["./directives_implementation_version.py:21:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 23: Unexpected errors ['./directives_implementation_version.py:23:16: int | str is not equivalent to int'] +Line 27: Unexpected errors ["./directives_implementation_version.py:27:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 32: Unexpected errors ['./directives_implementation_version.py:32:16: str | int is not equivalent to int'] +Line 37: Unexpected errors ["./directives_implementation_version.py:37:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 39: Unexpected errors ["./directives_implementation_version.py:39:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +""" +output = """ +./directives_implementation_version.py:18:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_version.py:21:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_version.py:23:16: int | str is not equivalent to int +./directives_implementation_version.py:27:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_version.py:30:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_version.py:32:16: str | int is not equivalent to int +./directives_implementation_version.py:35:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_implementation_version.py:37:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_version.py:39:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_implementation_version.py:41:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +""" diff --git a/conformance/results/pycroscope/directives_platform_checks.toml b/conformance/results/pycroscope/directives_platform_checks.toml new file mode 100644 index 000000000..15997fccb --- /dev/null +++ b/conformance/results/pycroscope/directives_platform_checks.toml @@ -0,0 +1,71 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for startswith or tuple, set, or list membership and nonmembership checks. +""" +errors_diff = """ +Line 39: Unexpected errors ["./directives_platform_checks.py:39:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 41: Unexpected errors ['./directives_platform_checks.py:41:16: int | str is not equivalent to int'] +Line 45: Unexpected errors ["./directives_platform_checks.py:45:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 50: Unexpected errors ['./directives_platform_checks.py:50:16: str | int is not equivalent to int'] +Line 75: Unexpected errors ["./directives_platform_checks.py:75:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 80: Unexpected errors ['./directives_platform_checks.py:80:16: str | int is not equivalent to int'] +Line 87: Unexpected errors ["./directives_platform_checks.py:87:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 89: Unexpected errors ['./directives_platform_checks.py:89:16: int | str is not equivalent to int'] +Line 96: Unexpected errors ["./directives_platform_checks.py:96:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 98: Unexpected errors ["./directives_platform_checks.py:98:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 110: Unexpected errors ["./directives_platform_checks.py:110:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 115: Unexpected errors ['./directives_platform_checks.py:115:16: str | int is not equivalent to int'] +Line 122: Unexpected errors ["./directives_platform_checks.py:122:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 124: Unexpected errors ['./directives_platform_checks.py:124:16: int | str is not equivalent to int'] +Line 130: Unexpected errors ["./directives_platform_checks.py:130:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 132: Unexpected errors ["./directives_platform_checks.py:132:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 144: Unexpected errors ["./directives_platform_checks.py:144:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 149: Unexpected errors ['./directives_platform_checks.py:149:16: str | int is not equivalent to int'] +Line 156: Unexpected errors ["./directives_platform_checks.py:156:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 158: Unexpected errors ['./directives_platform_checks.py:158:16: int | str is not equivalent to int'] +Line 164: Unexpected errors ["./directives_platform_checks.py:164:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 166: Unexpected errors ["./directives_platform_checks.py:166:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +""" +output = """ +./directives_platform_checks.py:18:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:24:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:36:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:39:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:41:16: int | str is not equivalent to int +./directives_platform_checks.py:45:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:48:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:50:16: str | int is not equivalent to int +./directives_platform_checks.py:65:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:66:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:75:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:78:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:80:16: str | int is not equivalent to int +./directives_platform_checks.py:84:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:87:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:89:16: int | str is not equivalent to int +./directives_platform_checks.py:94:12: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:96:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:98:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:100:12: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:110:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:113:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:115:16: str | int is not equivalent to int +./directives_platform_checks.py:119:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:122:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:124:16: int | str is not equivalent to int +./directives_platform_checks.py:128:12: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:130:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:132:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:134:12: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:144:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:147:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:149:16: str | int is not equivalent to int +./directives_platform_checks.py:153:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:156:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:158:16: int | str is not equivalent to int +./directives_platform_checks.py:162:12: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_platform_checks.py:164:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:166:12: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_platform_checks.py:168:12: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +""" diff --git a/conformance/results/pycroscope/directives_version_platform.toml b/conformance/results/pycroscope/directives_version_platform.toml index a6ce7215d..3ca982d04 100644 --- a/conformance/results/pycroscope/directives_version_platform.toml +++ b/conformance/results/pycroscope/directives_version_platform.toml @@ -9,4 +9,7 @@ output = """ ./directives_version_platform.py:67:21: val11 may be used uninitialized [possibly_undefined_name] ./directives_version_platform.py:74:21: val12 may be used uninitialized [possibly_undefined_name] ./directives_version_platform.py:75:18: val13 may be used uninitialized [possibly_undefined_name] +./directives_version_platform.py:84:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform.py:96:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform.py:111:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] """ diff --git a/conformance/results/pycroscope/directives_version_platform_boolean.toml b/conformance/results/pycroscope/directives_version_platform_boolean.toml new file mode 100644 index 000000000..cf423f9b9 --- /dev/null +++ b/conformance/results/pycroscope/directives_version_platform_boolean.toml @@ -0,0 +1,49 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not fully prune branches for and/or combinations of version and platform checks. +Does not prune branches for negated platform membership or combinations involving implementation checks. +""" +errors_diff = """ +Line 32: Unexpected errors ["./directives_version_platform_boolean.py:32:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 43: Unexpected errors ["./directives_version_platform_boolean.py:43:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 45: Unexpected errors ['./directives_version_platform_boolean.py:45:16: int | str is not equivalent to int'] +Line 65: Unexpected errors ["./directives_version_platform_boolean.py:65:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 70: Unexpected errors ['./directives_version_platform_boolean.py:70:16: str | int is not equivalent to int'] +Line 98: Unexpected errors ["./directives_version_platform_boolean.py:98:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 100: Unexpected errors ['./directives_version_platform_boolean.py:100:16: int | str is not equivalent to int'] +Line 115: Unexpected errors ["./directives_version_platform_boolean.py:115:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 118: Unexpected errors ["./directives_version_platform_boolean.py:118:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 120: Unexpected errors ['./directives_version_platform_boolean.py:120:16: int | str is not equivalent to int'] +Line 123: Unexpected errors ["./directives_version_platform_boolean.py:123:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +Line 129: Unexpected errors ["./directives_version_platform_boolean.py:129:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment]"] +""" +output = """ +./directives_version_platform_boolean.py:17:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:27:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:30:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:32:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:40:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:43:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:45:16: int | str is not equivalent to int +./directives_version_platform_boolean.py:50:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:54:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:58:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:65:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:68:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:70:16: str | int is not equivalent to int +./directives_version_platform_boolean.py:73:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:77:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:81:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:95:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:98:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:100:16: int | str is not equivalent to int +./directives_version_platform_boolean.py:110:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:115:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:118:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:120:16: int | str is not equivalent to int +./directives_version_platform_boolean.py:123:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:125:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:129:8: Incompatible assignment: expected int, got Literal['unreachable'] [incompatible_assignment] +./directives_version_platform_boolean.py:131:8: Incompatible assignment: expected int, got Literal['reachable'] [incompatible_assignment] +""" diff --git a/conformance/results/pyrefly/directives_implementation_name.toml b/conformance/results/pyrefly/directives_implementation_name.toml new file mode 100644 index 000000000..914dcc17f --- /dev/null +++ b/conformance/results/pyrefly/directives_implementation_name.toml @@ -0,0 +1,74 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.name equality or membership checks. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 23: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 27: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 32: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 36: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 42: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 44: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 54: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 56: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 60: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 65: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 68: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 74: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 84: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 86: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 90: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 95: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 98: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 104: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 114: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 116: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 120: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 125: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 128: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 134: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +""" +output = """ +ERROR directives_implementation_name.py:18:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:21:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:23:16-28: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:27:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:30:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:32:16-30: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:36:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:39:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:42:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:44:16-28: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:51:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:54:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:56:16-32: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:60:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:63:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:65:16-31: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:68:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:70:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:72:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:74:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:81:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:84:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:86:16-32: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:90:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:93:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:95:16-31: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:98:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:100:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:102:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:104:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:111:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:114:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:116:16-32: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:120:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:123:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:125:16-31: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_name.py:128:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:130:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:132:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_name.py:134:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +""" diff --git a/conformance/results/pyrefly/directives_implementation_version.toml b/conformance/results/pyrefly/directives_implementation_version.toml new file mode 100644 index 000000000..d81c12d72 --- /dev/null +++ b/conformance/results/pyrefly/directives_implementation_version.toml @@ -0,0 +1,25 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.version comparisons using the CPython target version. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 23: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 27: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 32: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 37: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 39: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +""" +output = """ +ERROR directives_implementation_version.py:18:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_version.py:21:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_version.py:23:16-34: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_version.py:27:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_version.py:30:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_version.py:32:16-37: assert_type(int | str, int) failed [assert-type] +ERROR directives_implementation_version.py:35:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_version.py:37:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_version.py:39:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_implementation_version.py:41:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +""" diff --git a/conformance/results/pyrefly/directives_platform_checks.toml b/conformance/results/pyrefly/directives_platform_checks.toml new file mode 100644 index 000000000..8a55b452e --- /dev/null +++ b/conformance/results/pyrefly/directives_platform_checks.toml @@ -0,0 +1,23 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +ERROR directives_platform_checks.py:18:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:24:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:36:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:48:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:65:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:66:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:78:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:84:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:94:21-32: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:100:21-32: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:113:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:119:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:128:21-32: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:134:21-32: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:147:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:153:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:162:21-32: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_platform_checks.py:168:21-32: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +""" diff --git a/conformance/results/pyrefly/directives_version_platform.toml b/conformance/results/pyrefly/directives_version_platform.toml index 562bdae49..d86833ae6 100644 --- a/conformance/results/pyrefly/directives_version_platform.toml +++ b/conformance/results/pyrefly/directives_version_platform.toml @@ -8,4 +8,7 @@ ERROR directives_version_platform.py:50:19-23: Could not find name `val6` [unkno ERROR directives_version_platform.py:59:19-23: Could not find name `val9` [unknown-name] ERROR directives_version_platform.py:66:19-24: Could not find name `val10` [unknown-name] ERROR directives_version_platform.py:75:19-24: Could not find name `val13` [unknown-name] +ERROR directives_version_platform.py:84:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform.py:96:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform.py:111:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] """ diff --git a/conformance/results/pyrefly/directives_version_platform_boolean.toml b/conformance/results/pyrefly/directives_version_platform_boolean.toml new file mode 100644 index 000000000..a44210baa --- /dev/null +++ b/conformance/results/pyrefly/directives_version_platform_boolean.toml @@ -0,0 +1,34 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for combinations involving implementation checks. +""" +errors_diff = """ +Line 115: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 118: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 120: Unexpected errors ['assert_type(int | str, int) failed [assert-type]'] +Line 123: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +Line 129: Unexpected errors ["`Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment]"] +""" +output = """ +ERROR directives_version_platform_boolean.py:17:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:27:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:30:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:40:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:50:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:54:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:58:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:68:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:73:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:77:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:81:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:95:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:110:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:115:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:118:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:120:16-31: assert_type(int | str, int) failed [assert-type] +ERROR directives_version_platform_boolean.py:123:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:125:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:129:17-30: `Literal['unreachable']` is not assignable to variable `error` with type `int` [bad-assignment] +ERROR directives_version_platform_boolean.py:131:17-28: `Literal['reachable']` is not assignable to variable `error` with type `int` [bad-assignment] +""" diff --git a/conformance/results/pyright/directives_implementation_name.toml b/conformance/results/pyright/directives_implementation_name.toml new file mode 100644 index 000000000..4b3593c9d --- /dev/null +++ b/conformance/results/pyright/directives_implementation_name.toml @@ -0,0 +1,105 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.name equality or membership checks. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_name.py:21:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 23: Unexpected errors ['directives_implementation_name.py:23:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 27: Unexpected errors ['directives_implementation_name.py:27:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 32: Unexpected errors ['directives_implementation_name.py:32:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 36: Unexpected errors ['directives_implementation_name.py:36:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 42: Unexpected errors ['directives_implementation_name.py:42:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 44: Unexpected errors ['directives_implementation_name.py:44:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 54: Unexpected errors ['directives_implementation_name.py:54:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 56: Unexpected errors ['directives_implementation_name.py:56:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 60: Unexpected errors ['directives_implementation_name.py:60:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 65: Unexpected errors ['directives_implementation_name.py:65:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 68: Unexpected errors ['directives_implementation_name.py:68:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 74: Unexpected errors ['directives_implementation_name.py:74:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 84: Unexpected errors ['directives_implementation_name.py:84:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 86: Unexpected errors ['directives_implementation_name.py:86:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 90: Unexpected errors ['directives_implementation_name.py:90:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 95: Unexpected errors ['directives_implementation_name.py:95:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 98: Unexpected errors ['directives_implementation_name.py:98:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 104: Unexpected errors ['directives_implementation_name.py:104:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 114: Unexpected errors ['directives_implementation_name.py:114:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 116: Unexpected errors ['directives_implementation_name.py:116:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 120: Unexpected errors ['directives_implementation_name.py:120:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 125: Unexpected errors ['directives_implementation_name.py:125:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 128: Unexpected errors ['directives_implementation_name.py:128:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 134: Unexpected errors ['directives_implementation_name.py:134:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +""" +output = """ +directives_implementation_name.py:18:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:21:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:23:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_implementation_name.py:27:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:30:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:32:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_implementation_name.py:36:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:39:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:42:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:44:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_implementation_name.py:51:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:54:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:56:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_implementation_name.py:60:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:63:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:65:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_implementation_name.py:68:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:70:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:72:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:74:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:81:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:84:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:86:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_implementation_name.py:90:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:93:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:95:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_implementation_name.py:98:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:100:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:102:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:104:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:111:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:114:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:116:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_implementation_name.py:120:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:123:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:125:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_implementation_name.py:128:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:130:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:132:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_name.py:134:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +""" diff --git a/conformance/results/pyright/directives_implementation_version.toml b/conformance/results/pyright/directives_implementation_version.toml new file mode 100644 index 000000000..005c16744 --- /dev/null +++ b/conformance/results/pyright/directives_implementation_version.toml @@ -0,0 +1,33 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.version comparisons using the CPython target version. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_version.py:21:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 23: Unexpected errors ['directives_implementation_version.py:23:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 27: Unexpected errors ['directives_implementation_version.py:27:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 32: Unexpected errors ['directives_implementation_version.py:32:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 37: Unexpected errors ['directives_implementation_version.py:37:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 39: Unexpected errors ['directives_implementation_version.py:39:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +""" +output = """ +directives_implementation_version.py:18:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_version.py:21:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_version.py:23:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_implementation_version.py:27:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_version.py:30:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_version.py:32:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_implementation_version.py:35:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_version.py:37:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_version.py:39:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_implementation_version.py:41:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +""" diff --git a/conformance/results/pyright/directives_platform_checks.toml b/conformance/results/pyright/directives_platform_checks.toml new file mode 100644 index 000000000..86e80d1e4 --- /dev/null +++ b/conformance/results/pyright/directives_platform_checks.toml @@ -0,0 +1,103 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for startswith or tuple, set, or list membership and nonmembership checks. +""" +errors_diff = """ +Line 39: Unexpected errors ['directives_platform_checks.py:39:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 41: Unexpected errors ['directives_platform_checks.py:41:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 45: Unexpected errors ['directives_platform_checks.py:45:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 50: Unexpected errors ['directives_platform_checks.py:50:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 75: Unexpected errors ['directives_platform_checks.py:75:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 80: Unexpected errors ['directives_platform_checks.py:80:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 87: Unexpected errors ['directives_platform_checks.py:87:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 89: Unexpected errors ['directives_platform_checks.py:89:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 96: Unexpected errors ['directives_platform_checks.py:96:21 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 98: Unexpected errors ['directives_platform_checks.py:98:21 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 110: Unexpected errors ['directives_platform_checks.py:110:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 115: Unexpected errors ['directives_platform_checks.py:115:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 122: Unexpected errors ['directives_platform_checks.py:122:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 124: Unexpected errors ['directives_platform_checks.py:124:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 130: Unexpected errors ['directives_platform_checks.py:130:21 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 132: Unexpected errors ['directives_platform_checks.py:132:21 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 144: Unexpected errors ['directives_platform_checks.py:144:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 149: Unexpected errors ['directives_platform_checks.py:149:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure)'] +Line 156: Unexpected errors ['directives_platform_checks.py:156:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 158: Unexpected errors ['directives_platform_checks.py:158:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 164: Unexpected errors ['directives_platform_checks.py:164:21 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 166: Unexpected errors ['directives_platform_checks.py:166:21 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +""" +output = """ +directives_platform_checks.py:18:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:24:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:36:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:39:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:41:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_platform_checks.py:45:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:48:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:50:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_platform_checks.py:65:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:66:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:75:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:78:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:80:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_platform_checks.py:84:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:87:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:89:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_platform_checks.py:94:21 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:96:21 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:98:21 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:100:21 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:110:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:113:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:115:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_platform_checks.py:119:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:122:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:124:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_platform_checks.py:128:21 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:130:21 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:132:21 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:134:21 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:144:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:147:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:149:17 - error: "assert_type" mismatch: expected "int" but received "str | int" (reportAssertTypeFailure) +directives_platform_checks.py:153:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:156:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:158:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_platform_checks.py:162:21 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:164:21 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:166:21 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_platform_checks.py:168:21 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +""" diff --git a/conformance/results/pyright/directives_version_platform.toml b/conformance/results/pyright/directives_version_platform.toml index e37efb6b3..592f8be68 100644 --- a/conformance/results/pyright/directives_version_platform.toml +++ b/conformance/results/pyright/directives_version_platform.toml @@ -5,6 +5,12 @@ directives_version_platform.py:50:19 - error: "val6" is not defined (reportUndef directives_version_platform.py:59:19 - error: "val9" is not defined (reportUndefinedVariable) directives_version_platform.py:66:19 - error: "val10" is not defined (reportUndefinedVariable) directives_version_platform.py:75:19 - error: "val13" is not defined (reportUndefinedVariable) +directives_version_platform.py:84:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform.py:96:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform.py:111:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyright/directives_version_platform_boolean.toml b/conformance/results/pyright/directives_version_platform_boolean.toml new file mode 100644 index 000000000..aed8381cf --- /dev/null +++ b/conformance/results/pyright/directives_version_platform_boolean.toml @@ -0,0 +1,56 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for negated platform membership or combinations involving implementation checks. +""" +errors_diff = """ +Line 32: Unexpected errors ['directives_version_platform_boolean.py:32:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 115: Unexpected errors ['directives_version_platform_boolean.py:115:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 118: Unexpected errors ['directives_version_platform_boolean.py:118:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 120: Unexpected errors ['directives_version_platform_boolean.py:120:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)'] +Line 123: Unexpected errors ['directives_version_platform_boolean.py:123:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +Line 129: Unexpected errors ['directives_version_platform_boolean.py:129:17 - error: Type "Literal[\\'unreachable\\']" is not assignable to declared type "int"'] +""" +output = """ +directives_version_platform_boolean.py:17:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:27:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:30:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:32:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:40:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:50:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:54:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:58:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:68:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:73:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:77:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:81:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:95:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:110:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:115:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:118:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:120:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) +directives_version_platform_boolean.py:123:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:125:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:129:17 - error: Type "Literal['unreachable']" is not assignable to declared type "int" +  "Literal['unreachable']" is not assignable to "int" (reportAssignmentType) +directives_version_platform_boolean.py:131:17 - error: Type "Literal['reachable']" is not assignable to declared type "int" +  "Literal['reachable']" is not assignable to "int" (reportAssignmentType) +""" diff --git a/conformance/results/results.html b/conformance/results/results.html index 7c89516d1..21abfed37 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -2602,6 +2602,84 @@

Python Type System Conformance Test Results

Pass Pass + + directives_implementation_name + + Unsupported + + + + Unsupported + + + + Unsupported + + + + Unsupported + + + + Unsupported + + + + Unsupported + + + + + directives_implementation_version + + Unsupported + + + + Unsupported + + + + Unsupported + + + + Unsupported + + + + Unsupported + + + + Unsupported + + + directives_no_type_check @@ -2622,6 +2700,40 @@

Python Type System Conformance Test Results

Pass Pass + + directives_platform_checks + + Partial + + + + Partial + + + Pass + + Partial + + + + Partial + + + + Partial + + + directives_reveal_type Pass @@ -2687,14 +2799,54 @@

Python Type System Conformance Test Results

Pass Pass + + directives_version_platform_boolean + + Partial + + + + Partial + + + + Partial + + + + Partial + + + + Partial + + + + Partial + + + - 10 / 11 • 90.9% - 10.5 / 11 • 95.5% - 11 / 11 • 100.0% - 10 / 11 • 90.9% - 10.5 / 11 • 95.5% - 11 / 11 • 100.0% + 11 / 15 • 73.3% + 11.5 / 15 • 76.7% + 12.5 / 15 • 83.3% + 11 / 15 • 73.3% + 11.5 / 15 • 76.7% + 12 / 15 • 80.0% @@ -2732,12 +2884,12 @@

Python Type System Conformance Test Results

- 108.5 / 145 • 74.8% - 127.5 / 145 • 87.9% - 140.5 / 145 • 96.9% - 135.5 / 145 • 93.4% - 128 / 145 • 88.3% - 140 / 145 • 96.6% + 109.5 / 149 • 73.5% + 128.5 / 149 • 86.2% + 142 / 149 • 95.3% + 136.5 / 149 • 91.6% + 129 / 149 • 86.6% + 141 / 149 • 94.6% diff --git a/conformance/results/ty/directives_implementation_name.toml b/conformance/results/ty/directives_implementation_name.toml new file mode 100644 index 000000000..32c327f4f --- /dev/null +++ b/conformance/results/ty/directives_implementation_name.toml @@ -0,0 +1,74 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.name equality or membership checks. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_name.py:21:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 23: Unexpected errors ['directives_implementation_name.py:23:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 27: Unexpected errors ['directives_implementation_name.py:27:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 32: Unexpected errors ['directives_implementation_name.py:32:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 36: Unexpected errors ['directives_implementation_name.py:36:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 42: Unexpected errors ['directives_implementation_name.py:42:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 44: Unexpected errors ['directives_implementation_name.py:44:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 54: Unexpected errors ['directives_implementation_name.py:54:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 56: Unexpected errors ['directives_implementation_name.py:56:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 60: Unexpected errors ['directives_implementation_name.py:60:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 65: Unexpected errors ['directives_implementation_name.py:65:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 68: Unexpected errors ['directives_implementation_name.py:68:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 74: Unexpected errors ['directives_implementation_name.py:74:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 84: Unexpected errors ['directives_implementation_name.py:84:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 86: Unexpected errors ['directives_implementation_name.py:86:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 90: Unexpected errors ['directives_implementation_name.py:90:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 95: Unexpected errors ['directives_implementation_name.py:95:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 98: Unexpected errors ['directives_implementation_name.py:98:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 104: Unexpected errors ['directives_implementation_name.py:104:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 114: Unexpected errors ['directives_implementation_name.py:114:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 116: Unexpected errors ['directives_implementation_name.py:116:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 120: Unexpected errors ['directives_implementation_name.py:120:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 125: Unexpected errors ['directives_implementation_name.py:125:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 128: Unexpected errors ['directives_implementation_name.py:128:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 134: Unexpected errors ['directives_implementation_name.py:134:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +""" +output = """ +directives_implementation_name.py:18:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:21:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:23:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_implementation_name.py:27:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:30:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:32:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_implementation_name.py:36:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:39:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:42:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:44:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_implementation_name.py:51:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:54:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:56:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_implementation_name.py:60:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:63:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:65:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_implementation_name.py:68:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:70:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:72:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:74:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:81:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:84:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:86:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_implementation_name.py:90:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:93:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:95:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_implementation_name.py:98:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:100:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:102:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:104:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:111:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:114:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:116:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_implementation_name.py:120:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:123:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:125:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_implementation_name.py:128:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_name.py:130:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:132:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_name.py:134:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +""" diff --git a/conformance/results/ty/directives_implementation_version.toml b/conformance/results/ty/directives_implementation_version.toml new file mode 100644 index 000000000..7fcbc1933 --- /dev/null +++ b/conformance/results/ty/directives_implementation_version.toml @@ -0,0 +1,25 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.version comparisons using the CPython target version. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_version.py:21:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 23: Unexpected errors ['directives_implementation_version.py:23:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 27: Unexpected errors ['directives_implementation_version.py:27:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 32: Unexpected errors ['directives_implementation_version.py:32:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 37: Unexpected errors ['directives_implementation_version.py:37:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 39: Unexpected errors ['directives_implementation_version.py:39:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +""" +output = """ +directives_implementation_version.py:18:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_version.py:21:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_version.py:23:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_implementation_version.py:27:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_version.py:30:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_version.py:32:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_implementation_version.py:35:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_implementation_version.py:37:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_version.py:39:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_implementation_version.py:41:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +""" diff --git a/conformance/results/ty/directives_platform_checks.toml b/conformance/results/ty/directives_platform_checks.toml new file mode 100644 index 000000000..afcf243c3 --- /dev/null +++ b/conformance/results/ty/directives_platform_checks.toml @@ -0,0 +1,51 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for set or list membership and nonmembership checks; tuple checks pass. +""" +errors_diff = """ +Line 110: Unexpected errors ['directives_platform_checks.py:110:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 115: Unexpected errors ['directives_platform_checks.py:115:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 122: Unexpected errors ['directives_platform_checks.py:122:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 124: Unexpected errors ['directives_platform_checks.py:124:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 130: Unexpected errors ['directives_platform_checks.py:130:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 132: Unexpected errors ['directives_platform_checks.py:132:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 144: Unexpected errors ['directives_platform_checks.py:144:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 149: Unexpected errors ['directives_platform_checks.py:149:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int`'] +Line 156: Unexpected errors ['directives_platform_checks.py:156:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 158: Unexpected errors ['directives_platform_checks.py:158:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 164: Unexpected errors ['directives_platform_checks.py:164:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 166: Unexpected errors ['directives_platform_checks.py:166:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +""" +output = """ +directives_platform_checks.py:18:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:24:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:36:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:48:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:65:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:66:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:78:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:84:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:94:21: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:100:21: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:110:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:113:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:115:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_platform_checks.py:119:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:122:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:124:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_platform_checks.py:128:21: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:130:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:132:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:134:21: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:144:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:147:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:149:5: error[type-assertion-failure] Type `str | int` does not match asserted type `int` +directives_platform_checks.py:153:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:156:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:158:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_platform_checks.py:162:21: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_platform_checks.py:164:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:166:21: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_platform_checks.py:168:21: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +""" diff --git a/conformance/results/ty/directives_version_platform.toml b/conformance/results/ty/directives_version_platform.toml index c74b90393..5dc18e9fc 100644 --- a/conformance/results/ty/directives_version_platform.toml +++ b/conformance/results/ty/directives_version_platform.toml @@ -7,4 +7,7 @@ directives_version_platform.py:50:19: error[unresolved-reference] Name `val6` us directives_version_platform.py:59:19: error[unresolved-reference] Name `val9` used when not defined directives_version_platform.py:66:19: error[unresolved-reference] Name `val10` used when not defined directives_version_platform.py:75:19: error[unresolved-reference] Name `val13` used when not defined +directives_version_platform.py:84:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform.py:96:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform.py:111:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` """ diff --git a/conformance/results/ty/directives_version_platform_boolean.toml b/conformance/results/ty/directives_version_platform_boolean.toml new file mode 100644 index 000000000..c27d28cab --- /dev/null +++ b/conformance/results/ty/directives_version_platform_boolean.toml @@ -0,0 +1,34 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for combinations involving implementation checks. +""" +errors_diff = """ +Line 115: Unexpected errors ['directives_version_platform_boolean.py:115:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 118: Unexpected errors ['directives_version_platform_boolean.py:118:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 120: Unexpected errors ['directives_version_platform_boolean.py:120:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int`'] +Line 123: Unexpected errors ['directives_version_platform_boolean.py:123:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +Line 129: Unexpected errors ['directives_version_platform_boolean.py:129:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int`'] +""" +output = """ +directives_version_platform_boolean.py:17:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:27:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:30:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:40:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:50:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:54:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:58:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:68:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:73:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:77:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:81:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:95:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:110:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:115:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_version_platform_boolean.py:118:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_version_platform_boolean.py:120:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_version_platform_boolean.py:123:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_version_platform_boolean.py:125:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +directives_version_platform_boolean.py:129:17: error[invalid-assignment] Object of type `Literal["unreachable"]` is not assignable to `int` +directives_version_platform_boolean.py:131:17: error[invalid-assignment] Object of type `Literal["reachable"]` is not assignable to `int` +""" diff --git a/conformance/results/zuban/directives_implementation_name.toml b/conformance/results/zuban/directives_implementation_name.toml new file mode 100644 index 000000000..97b238c2a --- /dev/null +++ b/conformance/results/zuban/directives_implementation_name.toml @@ -0,0 +1,74 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.name equality or membership checks. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_name.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 23: Unexpected errors ['directives_implementation_name.py:23: error: Expression is of type "int | str", not "int" [misc]'] +Line 27: Unexpected errors ['directives_implementation_name.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 32: Unexpected errors ['directives_implementation_name.py:32: error: Expression is of type "str | int", not "int" [misc]'] +Line 36: Unexpected errors ['directives_implementation_name.py:36: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 42: Unexpected errors ['directives_implementation_name.py:42: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 44: Unexpected errors ['directives_implementation_name.py:44: error: Expression is of type "str | int", not "int" [misc]'] +Line 54: Unexpected errors ['directives_implementation_name.py:54: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 56: Unexpected errors ['directives_implementation_name.py:56: error: Expression is of type "int | str", not "int" [misc]'] +Line 60: Unexpected errors ['directives_implementation_name.py:60: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 65: Unexpected errors ['directives_implementation_name.py:65: error: Expression is of type "str | int", not "int" [misc]'] +Line 68: Unexpected errors ['directives_implementation_name.py:68: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 74: Unexpected errors ['directives_implementation_name.py:74: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 84: Unexpected errors ['directives_implementation_name.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 86: Unexpected errors ['directives_implementation_name.py:86: error: Expression is of type "int | str", not "int" [misc]'] +Line 90: Unexpected errors ['directives_implementation_name.py:90: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 95: Unexpected errors ['directives_implementation_name.py:95: error: Expression is of type "str | int", not "int" [misc]'] +Line 98: Unexpected errors ['directives_implementation_name.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 104: Unexpected errors ['directives_implementation_name.py:104: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 114: Unexpected errors ['directives_implementation_name.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 116: Unexpected errors ['directives_implementation_name.py:116: error: Expression is of type "int | str", not "int" [misc]'] +Line 120: Unexpected errors ['directives_implementation_name.py:120: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 125: Unexpected errors ['directives_implementation_name.py:125: error: Expression is of type "str | int", not "int" [misc]'] +Line 128: Unexpected errors ['directives_implementation_name.py:128: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 134: Unexpected errors ['directives_implementation_name.py:134: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_implementation_name.py:18: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:23: error: Expression is of type "int | str", not "int" [misc] +directives_implementation_name.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:30: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:32: error: Expression is of type "str | int", not "int" [misc] +directives_implementation_name.py:36: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:39: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:42: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:44: error: Expression is of type "str | int", not "int" [misc] +directives_implementation_name.py:51: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:54: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:56: error: Expression is of type "int | str", not "int" [misc] +directives_implementation_name.py:60: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:63: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:65: error: Expression is of type "str | int", not "int" [misc] +directives_implementation_name.py:68: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:70: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:72: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:74: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:81: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:86: error: Expression is of type "int | str", not "int" [misc] +directives_implementation_name.py:90: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:93: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:95: error: Expression is of type "str | int", not "int" [misc] +directives_implementation_name.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:100: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:102: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:104: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:111: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:116: error: Expression is of type "int | str", not "int" [misc] +directives_implementation_name.py:120: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:123: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:125: error: Expression is of type "str | int", not "int" [misc] +directives_implementation_name.py:128: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:130: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:132: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_name.py:134: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/zuban/directives_implementation_version.toml b/conformance/results/zuban/directives_implementation_version.toml new file mode 100644 index 000000000..a6cb106ad --- /dev/null +++ b/conformance/results/zuban/directives_implementation_version.toml @@ -0,0 +1,25 @@ +conformant = "Unsupported" +notes = """ +Does not prune branches for sys.implementation.version comparisons using the CPython target version. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Unexpected errors ['directives_implementation_version.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 23: Unexpected errors ['directives_implementation_version.py:23: error: Expression is of type "int | str", not "int" [misc]'] +Line 27: Unexpected errors ['directives_implementation_version.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 32: Unexpected errors ['directives_implementation_version.py:32: error: Expression is of type "str | int", not "int" [misc]'] +Line 37: Unexpected errors ['directives_implementation_version.py:37: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 39: Unexpected errors ['directives_implementation_version.py:39: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_implementation_version.py:18: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:21: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:23: error: Expression is of type "int | str", not "int" [misc] +directives_implementation_version.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:30: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:32: error: Expression is of type "str | int", not "int" [misc] +directives_implementation_version.py:35: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:37: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:39: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_implementation_version.py:41: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/zuban/directives_platform_checks.toml b/conformance/results/zuban/directives_platform_checks.toml new file mode 100644 index 000000000..9dc84e8f0 --- /dev/null +++ b/conformance/results/zuban/directives_platform_checks.toml @@ -0,0 +1,63 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for tuple, set, or list membership and nonmembership checks. +""" +errors_diff = """ +Line 75: Unexpected errors ['directives_platform_checks.py:75: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 80: Unexpected errors ['directives_platform_checks.py:80: error: Expression is of type "str | int", not "int" [misc]'] +Line 87: Unexpected errors ['directives_platform_checks.py:87: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 89: Unexpected errors ['directives_platform_checks.py:89: error: Expression is of type "int | str", not "int" [misc]'] +Line 96: Unexpected errors ['directives_platform_checks.py:96: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 98: Unexpected errors ['directives_platform_checks.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 110: Unexpected errors ['directives_platform_checks.py:110: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 115: Unexpected errors ['directives_platform_checks.py:115: error: Expression is of type "str | int", not "int" [misc]'] +Line 122: Unexpected errors ['directives_platform_checks.py:122: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 124: Unexpected errors ['directives_platform_checks.py:124: error: Expression is of type "int | str", not "int" [misc]'] +Line 130: Unexpected errors ['directives_platform_checks.py:130: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 132: Unexpected errors ['directives_platform_checks.py:132: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 144: Unexpected errors ['directives_platform_checks.py:144: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 149: Unexpected errors ['directives_platform_checks.py:149: error: Expression is of type "str | int", not "int" [misc]'] +Line 156: Unexpected errors ['directives_platform_checks.py:156: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 158: Unexpected errors ['directives_platform_checks.py:158: error: Expression is of type "int | str", not "int" [misc]'] +Line 164: Unexpected errors ['directives_platform_checks.py:164: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 166: Unexpected errors ['directives_platform_checks.py:166: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_platform_checks.py:18: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:24: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:36: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:48: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:65: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:66: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:75: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:78: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:80: error: Expression is of type "str | int", not "int" [misc] +directives_platform_checks.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:87: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:89: error: Expression is of type "int | str", not "int" [misc] +directives_platform_checks.py:94: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:96: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:98: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:100: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:110: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:113: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:115: error: Expression is of type "str | int", not "int" [misc] +directives_platform_checks.py:119: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:122: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:124: error: Expression is of type "int | str", not "int" [misc] +directives_platform_checks.py:128: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:130: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:132: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:134: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:144: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:147: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:149: error: Expression is of type "str | int", not "int" [misc] +directives_platform_checks.py:153: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:156: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:158: error: Expression is of type "int | str", not "int" [misc] +directives_platform_checks.py:162: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:164: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:166: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_platform_checks.py:168: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/zuban/directives_version_platform.toml b/conformance/results/zuban/directives_version_platform.toml index 75af449a0..9d7d66398 100644 --- a/conformance/results/zuban/directives_version_platform.toml +++ b/conformance/results/zuban/directives_version_platform.toml @@ -7,4 +7,7 @@ directives_version_platform.py:33: error: Name "val3" is not defined [name-defi directives_version_platform.py:42: error: Expression is of type "int | str", not "int" [misc] directives_version_platform.py:50: error: Name "val6" is not defined [name-defined] directives_version_platform.py:59: error: Name "val9" is not defined [name-defined] +directives_version_platform.py:84: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform.py:96: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform.py:111: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] """ diff --git a/conformance/results/zuban/directives_version_platform_boolean.toml b/conformance/results/zuban/directives_version_platform_boolean.toml new file mode 100644 index 000000000..2496f273f --- /dev/null +++ b/conformance/results/zuban/directives_version_platform_boolean.toml @@ -0,0 +1,36 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not prune branches for negated platform membership or combinations involving implementation checks. +""" +errors_diff = """ +Line 32: Unexpected errors ['directives_version_platform_boolean.py:32: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 115: Unexpected errors ['directives_version_platform_boolean.py:115: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 118: Unexpected errors ['directives_version_platform_boolean.py:118: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 120: Unexpected errors ['directives_version_platform_boolean.py:120: error: Expression is of type "int | str", not "int" [misc]'] +Line 123: Unexpected errors ['directives_version_platform_boolean.py:123: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +Line 129: Unexpected errors ['directives_version_platform_boolean.py:129: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] +""" +output = """ +directives_version_platform_boolean.py:17: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:30: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:32: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:40: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:50: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:54: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:58: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:68: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:73: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:77: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:81: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:95: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:110: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:115: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:118: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:120: error: Expression is of type "int | str", not "int" [misc] +directives_version_platform_boolean.py:123: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:125: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:129: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform_boolean.py:131: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/tests/directives_implementation_name.py b/conformance/tests/directives_implementation_name.py new file mode 100644 index 000000000..7073af494 --- /dev/null +++ b/conformance/tests/directives_implementation_name.py @@ -0,0 +1,134 @@ +""" +Tests implementation-name equality and membership checks. + +These tests use the suite's Python 3.12 target and default CPython implementation. +""" + +# Specification: https://typing.python.org/en/latest/spec/directives.html#version-and-platform-checks + +import sys +from typing import assert_type + + +def test_name_equality(a: int, b: str) -> None: + # > Default value: ``"cpython"``, unless configured otherwise. + error: int = 0 + equal: int | str + if sys.implementation.name == "cpython": + error = "reachable" # E + equal = a + else: + error = "unreachable" + equal = b + assert_type(equal, int) + + unequal: int | str + if sys.implementation.name != "cpython": + error = "unreachable" + unequal = b + else: + error = "reachable" # E + unequal = a + assert_type(unequal, int) + + other: int | str + if sys.implementation.name == "micropython": + error = "unreachable" + other = b + elif sys.implementation.name != "micropython": + error = "reachable" # E + other = a + else: + error = "unreachable" + other = b + assert_type(other, int) + + +def test_name_tuple_membership(a: int, b: str) -> None: + error: int = 0 + contained: int | str + if sys.implementation.name in ("cpython", "pypy"): + error = "reachable" # E + contained = a + else: + error = "unreachable" + contained = b + assert_type(contained, int) + + excluded: int | str + if sys.implementation.name not in ("cpython",): + error = "unreachable" + excluded = b + else: + error = "reachable" # E + excluded = a + assert_type(excluded, int) + + if sys.implementation.name in ("micropython",): + error = "unreachable" + else: + error = "reachable" # E + if sys.implementation.name not in ("micropython", "pypy"): + error = "reachable" # E + else: + error = "unreachable" + + +def test_name_set_membership(a: int, b: str) -> None: + error: int = 0 + contained: int | str + if sys.implementation.name in {"cpython", "pypy"}: + error = "reachable" # E + contained = a + else: + error = "unreachable" + contained = b + assert_type(contained, int) + + excluded: int | str + if sys.implementation.name not in {"cpython"}: + error = "unreachable" + excluded = b + else: + error = "reachable" # E + excluded = a + assert_type(excluded, int) + + if sys.implementation.name in {"micropython"}: + error = "unreachable" + else: + error = "reachable" # E + if sys.implementation.name not in {"micropython", "pypy"}: + error = "reachable" # E + else: + error = "unreachable" + + +def test_name_list_membership(a: int, b: str) -> None: + error: int = 0 + contained: int | str + if sys.implementation.name in ["cpython", "pypy"]: + error = "reachable" # E + contained = a + else: + error = "unreachable" + contained = b + assert_type(contained, int) + + excluded: int | str + if sys.implementation.name not in ["cpython"]: + error = "unreachable" + excluded = b + else: + error = "reachable" # E + excluded = a + assert_type(excluded, int) + + if sys.implementation.name in ["micropython"]: + error = "unreachable" + else: + error = "reachable" # E + if sys.implementation.name not in ["micropython", "pypy"]: + error = "reachable" # E + else: + error = "unreachable" diff --git a/conformance/tests/directives_implementation_version.py b/conformance/tests/directives_implementation_version.py new file mode 100644 index 000000000..d6c6efc60 --- /dev/null +++ b/conformance/tests/directives_implementation_version.py @@ -0,0 +1,41 @@ +""" +Tests the CPython implementation-version default. + +These tests use the suite's Python 3.12 target and default CPython implementation. +""" + +# Specification: https://typing.python.org/en/latest/spec/directives.html#version-and-platform-checks + +import sys +from typing import assert_type + + +def test_implementation_version(a: int, b: str) -> None: + # For the default CPython target, use the configured language version. + error: int = 0 + at_boundary: int | str + if sys.implementation.version >= (3, 12): + error = "reachable" # E + at_boundary = a + else: + error = "unreachable" + at_boundary = b + assert_type(at_boundary, int) + + below_boundary: int | str + if sys.implementation.version < (3, 12): + error = "unreachable" + below_boundary = b + else: + error = "reachable" # E + below_boundary = a + assert_type(below_boundary, int) + + if sys.implementation.version < (3, 100): + error = "reachable" # E + else: + error = "unreachable" + if sys.implementation.version >= (3, 100): + error = "unreachable" + else: + error = "reachable" # E diff --git a/conformance/tests/directives_platform_checks.py b/conformance/tests/directives_platform_checks.py new file mode 100644 index 000000000..dee97e856 --- /dev/null +++ b/conformance/tests/directives_platform_checks.py @@ -0,0 +1,171 @@ +""" +Tests platform comparisons, literal containment, and prefix checks. +""" + +# Specification: https://typing.python.org/en/latest/spec/directives.html#version-and-platform-checks + +import sys +from typing import assert_type + + +def test_equality(a: int, b: str) -> None: + error: int = 0 + equal: int | str + if sys.platform == "bogus_platform": + error = "unreachable" + equal = b + else: + error = "reachable" # E + equal = a + assert_type(equal, int) + + unequal: int | str + if sys.platform != "bogus_platform": + error = "reachable" # E + unequal = a + else: + error = "unreachable" + unequal = b + assert_type(unequal, int) + + +def test_startswith(a: int, b: str) -> None: + error: int = 0 + empty_prefix: int | str + if sys.platform.startswith(""): + error = "reachable" # E: Every platform starts with the empty prefix. + empty_prefix = a + else: + error = "unreachable" + empty_prefix = b + assert_type(empty_prefix, int) + + unknown_prefix: int | str + if sys.platform.startswith("bogus_platform"): + error = "unreachable" + unknown_prefix = b + else: + error = "reachable" # E + unknown_prefix = a + assert_type(unknown_prefix, int) + + +def test_versioned_platform_prefix() -> None: + error: int = 0 + if sys.platform == "freebsd13": + if sys.platform.startswith("freebsd"): + error = "reachable" # E[freebsd_match] + else: + error = "unreachable" + if sys.platform.startswith("linux"): + error = "unreachable" + else: + error = "reachable" # E[freebsd_nonmatch] + else: + error = "reachable" # E[freebsd_match] + error = "reachable" # E[freebsd_nonmatch] + + +def test_tuple_membership(a: int, b: str) -> None: + # > The membership checks ``in`` and ``not in`` only support simple containment + # > testing with a literal tuple, literal set, or literal list of literal strings. + error: int = 0 + contained: int | str + if sys.platform in ("bogus_platform",): + error = "unreachable" + contained = b + else: + error = "reachable" # E + contained = a + assert_type(contained, int) + + excluded: int | str + if sys.platform not in ("bogus_platform", "another_bogus_platform"): + error = "reachable" # E + excluded = a + else: + error = "unreachable" + excluded = b + assert_type(excluded, int) + + # Positive matches are guarded so this file also works on non-Linux targets. + if sys.platform == "linux": + if sys.platform in ("linux", "darwin"): + error = "reachable" # E[tuple_match] + else: + error = "unreachable" + if sys.platform not in ("linux",): + error = "unreachable" + else: + error = "reachable" # E[tuple_nonmatch] + else: + error = "reachable" # E[tuple_match] + error = "reachable" # E[tuple_nonmatch] + + +def test_set_membership(a: int, b: str) -> None: + error: int = 0 + contained: int | str + if sys.platform in {"bogus_platform"}: + error = "unreachable" + contained = b + else: + error = "reachable" # E + contained = a + assert_type(contained, int) + + excluded: int | str + if sys.platform not in {"bogus_platform", "another_bogus_platform"}: + error = "reachable" # E + excluded = a + else: + error = "unreachable" + excluded = b + assert_type(excluded, int) + + if sys.platform == "linux": + if sys.platform in {"linux", "darwin"}: + error = "reachable" # E[set_match] + else: + error = "unreachable" + if sys.platform not in {"linux"}: + error = "unreachable" + else: + error = "reachable" # E[set_nonmatch] + else: + error = "reachable" # E[set_match] + error = "reachable" # E[set_nonmatch] + + +def test_list_membership(a: int, b: str) -> None: + error: int = 0 + contained: int | str + if sys.platform in ["bogus_platform"]: + error = "unreachable" + contained = b + else: + error = "reachable" # E + contained = a + assert_type(contained, int) + + excluded: int | str + if sys.platform not in ["bogus_platform", "another_bogus_platform"]: + error = "reachable" # E + excluded = a + else: + error = "unreachable" + excluded = b + assert_type(excluded, int) + + if sys.platform == "linux": + if sys.platform in ["linux", "darwin"]: + error = "reachable" # E[list_match] + else: + error = "unreachable" + if sys.platform not in ["linux"]: + error = "unreachable" + else: + error = "reachable" # E[list_nonmatch] + else: + error = "reachable" # E[list_match] + error = "reachable" # E[list_nonmatch] diff --git a/conformance/tests/directives_version_platform.py b/conformance/tests/directives_version_platform.py index 463c0e4d6..2709ef718 100644 --- a/conformance/tests/directives_version_platform.py +++ b/conformance/tests/directives_version_platform.py @@ -23,7 +23,7 @@ def test(a: int, b: str): else: val2 = b - assert_type(val2, int) # E?: May not generate an error (support for three-element sys.version is optional) + assert_type(val2, int) # E?: Support for three-element sys.version_info is optional. if sys.version_info < (3, 8): val3 = "" @@ -39,7 +39,7 @@ def test(a: int, b: str): else: val5 = b - assert_type(val5, int) # E?: May not generate an error (support for three-element sys.version is optional) + assert_type(val5, int) # E?: Support for three-element sys.version_info is optional. if sys.platform == "bogus_platform": @@ -73,3 +73,44 @@ def test(a: int, b: str): does_not_raise = val12 # E?: should not error if `os.name` control flow is supported, but might be flagged as possibly undefined otherwise this_raises = val13 # E?: `val13` is undefined, but support for `os.name` is optional + + +def test_version_boundaries(a: int, b: str) -> None: + # The conformance suite targets Python 3.12. + # > Required support is limited to comparisons against literal two-element tuples. + error: int = 0 + at_boundary: int | str + if sys.version_info >= (3, 12): + error = "reachable" # E: The boundary is inclusive. + at_boundary = a + else: + error = "unreachable" + at_boundary = b + assert_type(at_boundary, int) + + below_boundary: int | str + if sys.version_info < (3, 12): + error = "unreachable" + below_boundary = b + else: + error = "reachable" # E: The boundary is exclusive. + below_boundary = a + assert_type(below_boundary, int) + + +def test_version_elif(a: int, b: str) -> None: + error: int = 0 + selected: int | str + if sys.version_info >= (3, 100): + error = "unreachable" + selected = b + elif sys.version_info < (3, 8): + error = "unreachable" + selected = b + elif sys.version_info >= (3, 8): + error = "reachable" # E: Only this branch is reachable. + selected = a + else: + error = "unreachable" + selected = b + assert_type(selected, int) diff --git a/conformance/tests/directives_version_platform_boolean.py b/conformance/tests/directives_version_platform_boolean.py new file mode 100644 index 000000000..fa972c5cf --- /dev/null +++ b/conformance/tests/directives_version_platform_boolean.py @@ -0,0 +1,131 @@ +""" +Tests Boolean combinations of version, platform, and implementation checks. +""" + +# Specification: https://typing.python.org/en/latest/spec/directives.html#version-and-platform-checks + +import sys +from typing import assert_type + + +def test_not(a: int, b: str) -> None: + # > Type checkers should support combining these checks with: + # > * A ``not`` unary operator + error: int = 0 + selected: int | str + if not (sys.platform == "bogus_platform"): + error = "reachable" # E + selected = a + else: + error = "unreachable" + selected = b + assert_type(selected, int) + + if not (sys.version_info >= (3, 8)): + error = "unreachable" + else: + error = "reachable" # E + + if not (sys.platform in ("bogus_platform",)): + error = "reachable" # E + else: + error = "unreachable" + + +def test_and(a: int, b: str) -> None: + # > * An ``and`` or ``or`` binary operator + error: int = 0 + selected: int | str + if sys.version_info >= (3, 8) and sys.platform != "bogus_platform": + error = "reachable" # E + selected = a + else: + error = "unreachable" + selected = b + assert_type(selected, int) + + if sys.version_info >= (3, 8) and sys.platform == "bogus_platform": + error = "unreachable" + else: + error = "reachable" # E + if sys.version_info < (3, 8) and sys.platform != "bogus_platform": + error = "unreachable" + else: + error = "reachable" # E + if sys.version_info < (3, 8) and sys.platform == "bogus_platform": + error = "unreachable" + else: + error = "reachable" # E + + +def test_or(a: int, b: str) -> None: + error: int = 0 + selected: int | str + if sys.version_info < (3, 8) or sys.platform == "bogus_platform": + error = "unreachable" + selected = b + else: + error = "reachable" # E + selected = a + assert_type(selected, int) + + if sys.version_info >= (3, 8) or sys.platform == "bogus_platform": + error = "reachable" # E + else: + error = "unreachable" + if sys.version_info < (3, 8) or sys.platform != "bogus_platform": + error = "reachable" # E + else: + error = "unreachable" + if sys.version_info >= (3, 8) or sys.platform != "bogus_platform": + error = "reachable" # E + else: + error = "unreachable" + + +def test_nested_elif(a: int, b: str) -> None: + error: int = 0 + selected: int | str + if not (sys.version_info >= (3, 8) or sys.platform != "bogus_platform"): + error = "unreachable" + selected = b + elif sys.version_info >= (3, 8) and ( + sys.platform == "bogus_platform" or sys.platform != "bogus_platform" + ): + error = "reachable" # E + selected = a + else: + error = "unreachable" + selected = b + assert_type(selected, int) + + +def test_implementation_combinations(a: int, b: str) -> None: + error: int = 0 + selected: int | str + if sys.implementation.name == "cpython" and ( + sys.implementation.version >= (3, 12) + and not (sys.platform in ["bogus_platform"]) + ): + error = "reachable" # E + selected = a + elif sys.implementation.name == "micropython" and ( + sys.implementation.version >= (1, 24) + ): + error = "unreachable" + selected = b + else: + error = "unreachable" + selected = b + assert_type(selected, int) + + if not (sys.implementation.name in {"cpython", "pypy"}): + error = "unreachable" + else: + error = "reachable" # E + if sys.implementation.name != "cpython" or ( + sys.implementation.version < (3, 12) + ): + error = "unreachable" + else: + error = "reachable" # E diff --git a/docs/spec/directives.rst b/docs/spec/directives.rst index 488d71a26..4380fc34a 100644 --- a/docs/spec/directives.rst +++ b/docs/spec/directives.rst @@ -154,23 +154,224 @@ left undefined by the typing spec at this time. Version and platform checking ----------------------------- -Type checkers are expected to understand simple version and platform -checks, e.g.:: +Type checkers should understand code paths as definitely reachable or not reachable +due to comparison tests against these symbols: - import sys +* ``sys.version_info`` +* ``sys.platform`` +* ``sys.implementation.version`` +* ``sys.implementation.name`` - if sys.version_info >= (3, 12): - # Python 3.12+ - else: - # Python 3.11 and lower +Type checkers should support combining these checks with: - if sys.platform == 'win32': - # Windows specific definitions - else: - # Posix specific definitions +* A ``not`` unary operator +* An ``and`` or ``or`` binary operator -Don't expect a checker to understand obfuscations like -``"".join(reversed(sys.platform)) == "xunil"``. +Type checkers are only required to support the fully qualified form +(e.g., ``sys.platform``). Support for aliases or import variants +(e.g., ``from sys import platform``) is not required, though type checkers may +choose to support them. + +The comparison patterns for these variables are described in more detail in the +following paragraphs. + +sys.version_info checks +^^^^^^^^^^^^^^^^^^^^^^^^ + +Type checkers should support the following comparison patterns: + +* ``sys.version_info >= <2-tuple>`` +* ``sys.version_info < <2-tuple>`` + +where ``<2-tuple>`` is a literal tuple of two literal integers. + +Required support is limited to comparisons against literal two-element tuples. +Type checkers may choose to also support comparisons against three-element tuple +literals: ``sys.version_info >= <3-tuple>``. Type checkers are not expected to +support comparisons with named attributes of ``sys.version_info``. + +.. code-block:: python + :caption: Examples of ``sys.version_info`` checks + :emphasize-lines: 2,4 + + import sys + if sys.version_info >= (3, 13): + # Python 3.13+ + elif sys.version_info < (3, 11): + # Python 3.10 and lower + else: + # Python 3.11, 3.12 + +sys.platform checks +^^^^^^^^^^^^^^^^^^^ + +Type checkers should support the following comparison patterns: + +* ``sys.platform == `` +* ``sys.platform != `` +* ``sys.platform.startswith()`` +* ``sys.platform in `` +* ``sys.platform in `` +* ``sys.platform in `` +* ``sys.platform not in `` +* ``sys.platform not in `` +* ``sys.platform not in `` + +Common values: ``"linux"``, ``"darwin"``, ``"win32"``, ``"emscripten"``, +``"wasi"`` + +The membership checks ``in`` and ``not in`` only support simple containment +testing with a literal tuple, literal set, or literal list of literal strings. + +.. code-block:: python + :caption: Examples of ``sys.platform`` checks + :emphasize-lines: 2,4,6,8 + + import sys + if sys.platform == "win32": + # Windows-specific definitions + elif sys.platform in ("linux", "darwin"): + # Platform-specific stubs for Linux and macOS + elif sys.platform.startswith("freebsd"): + # FreeBSD-specific stubs, including versions such as "freebsd8" + if sys.platform not in ["wasi", "emscripten"]: + # Stubs for platforms other than WASI and Emscripten + + +sys.implementation.name checks +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Type checkers should support these comparison patterns with +``sys.implementation.name``: + +* ``sys.implementation.name == `` +* ``sys.implementation.name != `` +* ``sys.implementation.name in `` +* ``sys.implementation.name in `` +* ``sys.implementation.name in `` +* ``sys.implementation.name not in `` +* ``sys.implementation.name not in `` +* ``sys.implementation.name not in `` + +Default value: ``"cpython"``, unless configured otherwise. + +Common values: ``"cpython"``, ``"pypy"``, ``"micropython"``, ``"graalpy"``, +``"android"``, ``"ios"``, ``"ironpython"`` + +.. code-block:: python + :caption: Examples of ``sys.implementation.name`` checks + :emphasize-lines: 2,4 + + import sys + if sys.implementation.name == "cpython": + # CPython-specific stub + if sys.implementation.name == "micropython": + # MicroPython-specific stub + + +sys.implementation.version checks +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The value of ``sys.implementation.version`` is a tuple, in a similar format as +``sys.version_info``. However, it represents the version of the +*Python implementation* rather than the version of the *Python language*. This has +a distinct meaning from the specific version of the Python language to which the +currently running interpreter conforms. + +For CPython (``sys.implementation.name == "cpython"``) this is the same as +``sys.version_info``. +For other Python implementations the value of ``sys.implementation.version`` may +be specified in the type checker configuration or discovered at runtime. + +Type checkers should support the following comparison patterns: + +* ``sys.implementation.version >= <2-tuple>`` +* ``sys.implementation.version < <2-tuple>`` + +Required support is limited to comparisons against literal two-element tuples. +Type checkers may choose to also support comparisons against three-element tuple +literals of ``sys.implementation.version``. +Type checkers are not required to support comparisons against named attributes +of ``sys.implementation.version``. + +.. code-block:: python + :caption: Examples of ``sys.implementation.version`` checks + :emphasize-lines: 2,4 + + import sys + if sys.implementation.name == "pypy" and sys.implementation.version >= (7, 3): + # PyPy version 7.3 and above + elif sys.implementation.name == "micropython" and sys.implementation.version >= (1, 24): + # MicroPython version 1.24 and above + + +os.name checks +^^^^^^^^^^^^^^ + +Type checkers may optionally support comparisons of ``os.name`` with string +literals. + +* ``os.name == `` +* ``os.name != `` + +.. code-block:: python + :caption: Example of an ``os.name`` check + :emphasize-lines: 3 + + import os + + if os.name == "posix": + # POSIX-specific code + +Required forms and optional extensions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Type checkers must support the forms specified above as required. Support for additional +comparison patterns and syntax forms is optional. For example, +type checkers are not required to support the following forms: + +.. code-block:: python + :caption: Examples of forms that type checkers are not required to support + :emphasize-lines: 4,6,8 + + import sys + from sys import platform + + if "".join(reversed(sys.platform)) == "xunil": + # Comparison using a computed value + if platform == "linux": + # Comparison using an imported alias + if "win" not in sys.platform: + # Substring membership test against sys.platform + +Configuration +^^^^^^^^^^^^^ + +Type checkers should be able to retrieve the information from the Python +implementation's runtime environment, or provide configuration or CLI options +to specify target ``sys.version_info``, ``sys.platform``, +``sys.implementation.name`` and ``sys.implementation.version``. + +============================== ======================== ============= ===================================== +Symbol Suggested Format Example Suggested Default +============================== ======================== ============= ===================================== +``sys.version_info`` string ``"major.minor"`` ``"3.11"`` The version of the Python interpreter + used to run the type checker. +``sys.platform`` lowercase string ``"linux"`` The platform of the Python interpreter + used to run the type checker. +``sys.implementation.name`` lowercase string ``"cpython"`` ``"cpython"`` unless configured + otherwise. +``sys.implementation.version`` string ``"major.minor"`` ``"3.14"`` On CPython, default to the value used + for ``sys.version_info``. On other + implementations, the value should be + provided in configuration or + otherwise inferred. +============================== ======================== ============= ===================================== + +The configuration options should allow users to specify the target values for these +symbols, so that type checkers can evaluate the version and platform checks +correctly. The exact mechanism and names for these configuration options are +implementation-specific and defined by each type checker. .. _`deprecated`: