From ebfb18f5613f4906116951bd2258acb29db900ca Mon Sep 17 00:00:00 2001 From: Cloud0310 <60375730+Cloud0310@users.noreply.github.com> Date: Sat, 22 Nov 2025 20:23:16 +0800 Subject: [PATCH 1/3] feat: add conformance test workflow and enhance options for skipping install checks --- .github/workflows/conformance-test.yml | 121 +++++++++++++++++++++++++ conformance/src/main.py | 13 ++- conformance/src/options.py | 10 +- 3 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/conformance-test.yml diff --git a/.github/workflows/conformance-test.yml b/.github/workflows/conformance-test.yml new file mode 100644 index 00000000..e0f96b90 --- /dev/null +++ b/.github/workflows/conformance-test.yml @@ -0,0 +1,121 @@ +name: Update Typing Conformance Tests Results + +on: + schedule: + - cron: "45 11 * * 1" + workflow_dispatch: + +permissions: + contents: write + +jobs: + check-versions: + runs-on: ubuntu-latest + outputs: + has_updates: ${{ steps.compare.outputs.has_updates }} + steps: + - name: Restore previous version state + id: restore-cache + uses: actions/cache/restore@v4 + with: + path: tool_versions.json + # We use a key that will mis s, forcing it to look at restore-keys + key: tool-state-placeholder-${{ github.run_id }} + # This picks the most recent cache matching this prefix + restore-keys: | + tool-state- + + - name: Check and Compare Versions + id: compare + run: | + TOOLS=("zuban" "pyrefly" "pyright" "mypy") + STATE_FILE="tool_versions.json" + UPDATED=false + + # Load previous state or create empty if first run + if [ -f "$STATE_FILE" ]; then + echo "Found previous state." + else + echo "{}" > "$STATE_FILE" + echo "No previous state found (First Run). Treating as updated." + # We force update to true on first run to populate the cache + UPDATED=true + fi + + # Temp file for the new state + NEW_STATE=$(mktemp) + echo "{}" > "$NEW_STATE" + + echo "Fetching versions from PyPI..." + + for tool in "${TOOLS[@]}"; do + # Fetch latest version string + LATEST=$(curl -sL "https://pypi.org/pypi/$tool/json" | jq -r '.info.version') + + # Get old version from JSON + OLD=$(jq -r --arg t "$tool" '.[$t] // ""' "$STATE_FILE") + + echo "Checking $tool: Old=$OLD | New=$LATEST" + + # Write to new state object + jq --arg t "$tool" --arg v "$LATEST" '.[$t] = $v' "$NEW_STATE" > "$NEW_STATE.tmp" && mv "$NEW_STATE.tmp" "$NEW_STATE" + + if [ "$LATEST" != "$OLD" ]; then + echo ">> UPDATE DETECTED for $tool" + UPDATED=true + fi + done + + if [ "$UPDATED" = "true" ]; then + echo "has_updates=true" >> $GITHUB_OUTPUT + # Replace the state file with the new one so Cache Save picks it up + mv "$NEW_STATE" "$STATE_FILE" + cat "$STATE_FILE" + else + echo "has_updates=false" >> $GITHUB_OUTPUT + echo "No updates found." + fi + + - name: Save new state to cache + if: steps.compare.outputs.has_updates == 'true' + uses: actions/cache/save@v4 + with: + path: tool_versions.json + # Unique key ensures a new cache entry is created + key: tool-state-${{ github.run_id }} + + run-conformance-tests: + needs: check-versions + if: needs.check-versions.outputs.has_updates == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v6 + with: + sparse-checkout: | + conformance + + - uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Install Dependencies + run: | + cd conformance + pip install -r requirements.txt + + - name: Run Main Script (Src) + run: | + cd conformance/src + python main.py --skip-install-check + + - name: Commit and Push results + run: | + # go dir `conformance` + cd conformance + echo "Typing static type checkers has updated, commit and push new results" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add ./results/* + git commit -m "chore: update conformance test results" + git push diff --git a/conformance/src/main.py b/conformance/src/main.py index 62a827bc..390d61b6 100644 --- a/conformance/src/main.py +++ b/conformance/src/main.py @@ -3,15 +3,14 @@ """ import os -from pathlib import Path import re import sys +from pathlib import Path from time import time from typing import Sequence import tomli import tomlkit - from options import parse_options from reporting import generate_summary from test_groups import get_test_cases, get_test_groups @@ -262,10 +261,14 @@ def main(): for type_checker in TYPE_CHECKERS: if options.only_run and options.only_run != type_checker.name: continue - if not type_checker.install(): - print(f"Skipping tests for {type_checker.name}") + if options.skip_install_check: + print("Skipping install check") else: - run_tests(root_dir, type_checker, test_cases) + if not type_checker.install(): + print(f"Skipping tests for {type_checker.name}") + continue + + run_tests(root_dir, type_checker, test_cases) # Generate a summary report. generate_summary(root_dir) diff --git a/conformance/src/options.py b/conformance/src/options.py index 76c2c5be..2d72eb61 100644 --- a/conformance/src/options.py +++ b/conformance/src/options.py @@ -7,10 +7,12 @@ from type_checker import TYPE_CHECKERS + @dataclass class _Options: report_only: bool | None only_run: str | None + skip_install_check: bool | None def parse_options(argv: list[str]) -> _Options: @@ -24,7 +26,13 @@ def parse_options(argv: list[str]) -> _Options: reporting_group.add_argument( "--only-run", help="Only runs the type checker", - choices=[tc.name for tc in TYPE_CHECKERS] + choices=[tc.name for tc in TYPE_CHECKERS], ) + reporting_group.add_argument( + "--skip-install-check", + action="store_true", + help="Skips the check for whether type checkers are installed", + ) + ret = _Options(**vars(parser.parse_args(argv))) return ret From 01b1ccb20532be4500534b9678a8e7d052b554f2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 22 Nov 2025 12:25:17 +0000 Subject: [PATCH 2/3] chore: update conformance test results --- conformance/results/pyrefly/dataclasses_final.toml | 6 +++--- .../results/pyrefly/dataclasses_transform_converter.toml | 2 -- conformance/results/pyrefly/generics_defaults.toml | 2 +- conformance/results/pyrefly/generics_syntax_scoping.toml | 8 ++++---- conformance/results/pyrefly/protocols_class_objects.toml | 6 ++---- conformance/results/pyrefly/protocols_explicit.toml | 2 +- conformance/results/pyrefly/typeddicts_class_syntax.toml | 6 +++--- .../results/pyrefly/typeddicts_readonly_inheritance.toml | 4 ++-- conformance/results/pyrefly/typeddicts_required.toml | 4 +--- conformance/results/pyrefly/version.toml | 2 +- conformance/results/results.html | 4 ++-- conformance/results/zuban/version.toml | 2 +- 12 files changed, 21 insertions(+), 27 deletions(-) diff --git a/conformance/results/pyrefly/dataclasses_final.toml b/conformance/results/pyrefly/dataclasses_final.toml index eed3df1b..5c34cd6f 100644 --- a/conformance/results/pyrefly/dataclasses_final.toml +++ b/conformance/results/pyrefly/dataclasses_final.toml @@ -2,13 +2,13 @@ conformant = "Partial" notes = """ Allows assignment to final attributes that are not initialized on the class """ -conformance_automated = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 35: Expected 1 errors -Line 37: Expected 1 errors """ output = """ ERROR dataclasses_final.py:27:1-17: Cannot set field `final_classvar` [read-only] +ERROR dataclasses_final.py:35:1-19: Cannot set field `final_no_default` [read-only] ERROR dataclasses_final.py:36:1-21: Cannot set field `final_with_default` [read-only] +ERROR dataclasses_final.py:37:1-19: Cannot set field `final_no_default` [read-only] ERROR dataclasses_final.py:38:1-21: Cannot set field `final_with_default` [read-only] """ diff --git a/conformance/results/pyrefly/dataclasses_transform_converter.toml b/conformance/results/pyrefly/dataclasses_transform_converter.toml index c3b990de..eca9d49c 100644 --- a/conformance/results/pyrefly/dataclasses_transform_converter.toml +++ b/conformance/results/pyrefly/dataclasses_transform_converter.toml @@ -4,9 +4,7 @@ errors_diff = """ """ output = """ ERROR dataclasses_transform_converter.py:48:41-55: Argument `() -> int` is not assignable to parameter `converter` with type `(@_) -> int` in function `model_field` [bad-argument-type] -ERROR dataclasses_transform_converter.py:48:41-55: Argument `() -> int` is not assignable to parameter `converter` with type `(@_) -> @_` in function `model_field` [bad-argument-type] ERROR dataclasses_transform_converter.py:49:41-55: Argument `(*, x: int) -> int` is not assignable to parameter `converter` with type `(@_) -> int` in function `model_field` [bad-argument-type] -ERROR dataclasses_transform_converter.py:49:41-55: Argument `(*, x: int) -> int` is not assignable to parameter `converter` with type `(@_) -> @_` in function `model_field` [bad-argument-type] ERROR dataclasses_transform_converter.py:107:5-6: Argument `Literal[1]` is not assignable to parameter `field0` with type `str` in function `DC2.__init__` [bad-argument-type] ERROR dataclasses_transform_converter.py:108:23-24: Argument `Literal[1]` is not assignable to parameter `field3` with type `bytes | str` in function `DC2.__init__` [bad-argument-type] ERROR dataclasses_transform_converter.py:109:29-31: Argument `complex` is not assignable to parameter `field4` with type `list[str] | str` in function `DC2.__init__` [bad-argument-type] diff --git a/conformance/results/pyrefly/generics_defaults.toml b/conformance/results/pyrefly/generics_defaults.toml index 3216033d..2bef8963 100644 --- a/conformance/results/pyrefly/generics_defaults.toml +++ b/conformance/results/pyrefly/generics_defaults.toml @@ -11,7 +11,7 @@ ERROR generics_defaults.py:24:7-31: Type parameter `T` without a default cannot ERROR generics_defaults.py:50:1-20: Expected 5 type arguments for `AllTheDefaults`, got 1 [bad-specialization] ERROR generics_defaults.py:107:51-54: Expected default `int` of `Invalid1` to be assignable to the upper bound of `str` [invalid-type-var] ERROR generics_defaults.py:114:52-55: Expected default `int` of `Invalid2` to be one of the following constraints: `float`, `str` [invalid-type-var] -ERROR generics_defaults.py:130:12-27: assert_type(Any, int) failed [assert-type] +ERROR generics_defaults.py:131:12-27: assert_type(int, Any) failed [assert-type] ERROR generics_defaults.py:142:7-11: TypeVar `T5` with a default cannot follow TypeVarTuple `Ts` [invalid-type-var] ERROR generics_defaults.py:170:12-57: assert_type([DefaultIntT](Foo7[DefaultIntT]) -> Foo7[DefaultIntT], (Foo7[int]) -> Foo7[int]) failed [assert-type] """ diff --git a/conformance/results/pyrefly/generics_syntax_scoping.toml b/conformance/results/pyrefly/generics_syntax_scoping.toml index f569cc93..b02d9808 100644 --- a/conformance/results/pyrefly/generics_syntax_scoping.toml +++ b/conformance/results/pyrefly/generics_syntax_scoping.toml @@ -2,11 +2,8 @@ conformant = "Partial" notes = """ Does not implement some scoping restrictions for PEP695 generic syntax """ -conformance_automated = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 92: Expected 1 errors -Line 95: Expected 1 errors -Line 98: Expected 1 errors """ output = """ ERROR generics_syntax_scoping.py:14:20-31: Type variable bounds and constraints must be concrete [invalid-annotation] @@ -14,4 +11,7 @@ ERROR generics_syntax_scoping.py:18:26-27: Expected a type form, got instance of ERROR generics_syntax_scoping.py:35:7-8: `T` is uninitialized [unbound-name] ERROR generics_syntax_scoping.py:44:17-18: `T` is uninitialized [unbound-name] ERROR generics_syntax_scoping.py:44:17-18: Expected a type form, got instance of `int` [not-a-type] +ERROR generics_syntax_scoping.py:92:17-18: Type parameter `T` shadows a type parameter of the same name from an enclosing scope [invalid-type-var] +ERROR generics_syntax_scoping.py:95:17-18: Type parameter `T` shadows a type parameter of the same name from an enclosing scope [invalid-type-var] +ERROR generics_syntax_scoping.py:98:17-18: Type parameter `T` shadows a type parameter of the same name from an enclosing scope [invalid-type-var] """ diff --git a/conformance/results/pyrefly/protocols_class_objects.toml b/conformance/results/pyrefly/protocols_class_objects.toml index 68cdca5c..e18c3614 100644 --- a/conformance/results/pyrefly/protocols_class_objects.toml +++ b/conformance/results/pyrefly/protocols_class_objects.toml @@ -4,16 +4,14 @@ Does not require concrete classes to be passed to type[Proto] """ conformance_automated = "Fail" errors_diff = """ -Line 29: Expected 1 errors -Line 34: Expected 1 errors Line 104: Expected 1 errors Line 106: Expected 1 errors Line 107: Expected 1 errors Line 108: Expected 1 errors -Line 26: Unexpected errors ['Cannot instantiate `Proto` because it is a protocol [bad-instantiation]'] """ output = """ -ERROR protocols_class_objects.py:26:15-17: Cannot instantiate `Proto` because it is a protocol [bad-instantiation] +ERROR protocols_class_objects.py:29:5-10: Argument `type[Proto]` is not assignable to parameter `cls` with type `type[Proto]` in function `fun` [bad-argument-type] +ERROR protocols_class_objects.py:34:7-12: `type[Proto]` is not assignable to variable `var` with type `type[Proto]` [bad-assignment] ERROR protocols_class_objects.py:58:16-25: `type[ConcreteA]` is not assignable to `ProtoA1` [bad-assignment] ERROR protocols_class_objects.py:74:16-25: `type[ConcreteB]` is not assignable to `ProtoB1` [bad-assignment] """ diff --git a/conformance/results/pyrefly/protocols_explicit.toml b/conformance/results/pyrefly/protocols_explicit.toml index cff8b33c..3986491f 100644 --- a/conformance/results/pyrefly/protocols_explicit.toml +++ b/conformance/results/pyrefly/protocols_explicit.toml @@ -5,10 +5,10 @@ Does not detect stub methods inherited from protocols as abstract. """ conformance_automated = "Fail" errors_diff = """ -Line 27: Expected 1 errors Line 89: Expected 1 errors """ output = """ +ERROR protocols_explicit.py:27:16-28: Method `draw` inherited from class `PColor` has no implementation and cannot be accessed via `super()` [missing-attribute] ERROR protocols_explicit.py:56:20-36: `tuple[int, int, str]` is not assignable to attribute `rgb` with type `tuple[int, int, int]` [bad-assignment] ERROR protocols_explicit.py:60:10-20: Cannot instantiate `Point` because the following members are abstract: `intensity`, `transparency` [bad-instantiation] ERROR protocols_explicit.py:134:15-17: Cannot instantiate `Concrete5` because the following members are abstract: `method1` [bad-instantiation] diff --git a/conformance/results/pyrefly/typeddicts_class_syntax.toml b/conformance/results/pyrefly/typeddicts_class_syntax.toml index c620b102..4fec5a41 100644 --- a/conformance/results/pyrefly/typeddicts_class_syntax.toml +++ b/conformance/results/pyrefly/typeddicts_class_syntax.toml @@ -3,9 +3,9 @@ conformance_automated = "Pass" errors_diff = """ """ output = """ -ERROR typeddicts_class_syntax.py:29:9-16: TypedDict item `method1` may not be initialized [bad-class-definition] -ERROR typeddicts_class_syntax.py:34:9-16: TypedDict item `method2` may not be initialized [bad-class-definition] -ERROR typeddicts_class_syntax.py:39:9-16: TypedDict item `method3` may not be initialized [bad-class-definition] +ERROR typeddicts_class_syntax.py:29:9-16: TypedDict members must be declared in the form `field: Annotation` with no assignment [bad-class-definition] +ERROR typeddicts_class_syntax.py:34:9-16: TypedDict members must be declared in the form `field: Annotation` with no assignment [bad-class-definition] +ERROR typeddicts_class_syntax.py:39:9-16: TypedDict members must be declared in the form `field: Annotation` with no assignment [bad-class-definition] ERROR typeddicts_class_syntax.py:44:7-20: Typed dictionary definitions may not specify a metaclass [invalid-inheritance] ERROR typeddicts_class_syntax.py:49:7-20: TypedDict does not support keyword argument `other` [bad-typed-dict] """ diff --git a/conformance/results/pyrefly/typeddicts_readonly_inheritance.toml b/conformance/results/pyrefly/typeddicts_readonly_inheritance.toml index 12866032..c7d1f621 100644 --- a/conformance/results/pyrefly/typeddicts_readonly_inheritance.toml +++ b/conformance/results/pyrefly/typeddicts_readonly_inheritance.toml @@ -2,9 +2,8 @@ conformant = "Partial" notes = """ Does not restrictions around overriding for ReadOnly fields """ -conformance_automated = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 119: Expected 1 errors """ output = """ ERROR typeddicts_readonly_inheritance.py:36:4-10: Key `name` in TypedDict `Album2` is read-only [read-only] @@ -16,5 +15,6 @@ ERROR typeddicts_readonly_inheritance.py:84:5-7: Missing required key `ident` fo ERROR typeddicts_readonly_inheritance.py:94:5-6: TypedDict field `a` in `F3` cannot be marked read-only; parent TypedDict `F1` defines it as mutable [bad-typed-dict-key] ERROR typeddicts_readonly_inheritance.py:98:5-6: TypedDict field `a` in `F4` must remain required because parent TypedDict `F1` defines it as required [bad-typed-dict-key] ERROR typeddicts_readonly_inheritance.py:106:5-6: TypedDict field `c` in `F6` cannot be made non-required; parent TypedDict `F1` defines it as required [bad-typed-dict-key] +ERROR typeddicts_readonly_inheritance.py:119:7-11: Field `x` is declared `float` in ancestor `class TD_A2: ... ERROR typeddicts_readonly_inheritance.py:132:7-11: TypedDict field `x` in `TD_B` cannot be made non-required; parent TypedDict `TD_B2` defines it as required [bad-typed-dict-key] """ diff --git a/conformance/results/pyrefly/typeddicts_required.toml b/conformance/results/pyrefly/typeddicts_required.toml index 8af58214..87749507 100644 --- a/conformance/results/pyrefly/typeddicts_required.toml +++ b/conformance/results/pyrefly/typeddicts_required.toml @@ -2,9 +2,8 @@ conformant = "Partial" notes = """ Does not handle recursive typed dicts in functional syntax """ -conformance_automated = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 71: Unexpected errors ["Expected a type form, got instance of `Literal['RecursiveMovie']` [not-a-type]"] """ output = """ ERROR typeddicts_required.py:12:5-6: `Required` may only be used for TypedDict members [invalid-annotation] @@ -12,5 +11,4 @@ ERROR typeddicts_required.py:16:8-19: `NotRequired` is only allowed inside a cla ERROR typeddicts_required.py:16:8-24: `NotRequired` is not allowed in this context [invalid-annotation] ERROR typeddicts_required.py:59:8-31: Duplicate qualifier `Required` [invalid-annotation] ERROR typeddicts_required.py:60:8-34: Cannot combine `Required` and `NotRequired` for a TypedDict field [invalid-annotation] -ERROR typeddicts_required.py:71:75-91: Expected a type form, got instance of `Literal['RecursiveMovie']` [not-a-type] """ diff --git a/conformance/results/pyrefly/version.toml b/conformance/results/pyrefly/version.toml index e0f0cc51..51bc5668 100644 --- a/conformance/results/pyrefly/version.toml +++ b/conformance/results/pyrefly/version.toml @@ -1 +1 @@ -version = "pyrefly 0.39.4" +version = "pyrefly 0.42.3" diff --git a/conformance/results/results.html b/conformance/results/results.html index 8570f7c6..0fe3276b 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -162,9 +162,9 @@

Python Type System Conformance Test Results

pyright 1.1.407
-
zuban 0.2.1
+
zuban 0.2.3
-
pyrefly 0.39.4
+
pyrefly 0.42.3
diff --git a/conformance/results/zuban/version.toml b/conformance/results/zuban/version.toml index eeff6b71..8938624f 100644 --- a/conformance/results/zuban/version.toml +++ b/conformance/results/zuban/version.toml @@ -1 +1 @@ -version = "zuban 0.2.1" +version = "zuban 0.2.3" From c7b66cfc3927b07ee51164d56376dba66ece1eff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:48:11 +0000 Subject: [PATCH 3/3] chore: update conformance test results --- .../results/mypy/callables_annotation.toml | 10 ++--- .../results/mypy/callables_kwargs.toml | 12 +++--- .../results/mypy/callables_protocol.toml | 42 +++++++++---------- .../mypy/dataclasses_transform_converter.toml | 2 +- .../mypy/generics_paramspec_semantics.toml | 6 +-- .../results/mypy/generics_syntax_scoping.toml | 3 +- .../results/mypy/narrowing_typeguard.toml | 2 +- .../results/mypy/narrowing_typeis.toml | 2 +- .../mypy/typeddicts_type_consistency.toml | 2 - conformance/results/mypy/version.toml | 2 +- .../pyrefly/generics_typevartuple_concat.toml | 4 +- conformance/results/pyrefly/version.toml | 2 +- conformance/results/results.html | 4 +- 13 files changed, 45 insertions(+), 48 deletions(-) diff --git a/conformance/results/mypy/callables_annotation.toml b/conformance/results/mypy/callables_annotation.toml index c8af7158..11daf620 100644 --- a/conformance/results/mypy/callables_annotation.toml +++ b/conformance/results/mypy/callables_annotation.toml @@ -17,17 +17,17 @@ callables_annotation.py:57: error: Bracketed expression "[...]" is not valid as callables_annotation.py:57: note: Did you mean "List[...]"? callables_annotation.py:58: error: Please use "Callable[[], ]" or "Callable" [misc] callables_annotation.py:59: error: Unexpected "..." [misc] -callables_annotation.py:91: error: Incompatible types in assignment (expression has type "Callable[[], str]", variable has type "Callable[[int, VarArg(Any), KwArg(Any)], str]") [assignment] -callables_annotation.py:93: error: Incompatible types in assignment (expression has type "Callable[[NamedArg(int, 'a')], str]", variable has type "Callable[[int, VarArg(Any), KwArg(Any)], str]") [assignment] +callables_annotation.py:91: error: Incompatible types in assignment (expression has type "Callable[[], str]", variable has type "def (int, /, *Any, **Any) -> str") [assignment] +callables_annotation.py:93: error: Incompatible types in assignment (expression has type "def test_cb4(*, a: int) -> str", variable has type "def (int, /, *Any, **Any) -> str") [assignment] callables_annotation.py:157: error: Incompatible types in assignment (expression has type "Proto7", variable has type "Proto6") [assignment] callables_annotation.py:157: note: Following member(s) of "Proto7" have conflicts: callables_annotation.py:157: note: Expected: callables_annotation.py:157: note: def __call__(self, int, /, *args: Any, k: str, **kwargs: Any) -> None callables_annotation.py:157: note: Got: callables_annotation.py:157: note: def __call__(self, float, /, b: int, *, k: str, m: str) -> None -callables_annotation.py:172: error: Incompatible types in assignment (expression has type "Callable[[], str]", variable has type "Callable[[int, VarArg(Any), KwArg(Any)], str]") [assignment] -callables_annotation.py:187: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "Callable[[str, VarArg(Any), KwArg(Any)], str]") [assignment] -callables_annotation.py:189: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "Callable[[str, VarArg(Any), KwArg(Any)], str]") [assignment] +callables_annotation.py:172: error: Incompatible types in assignment (expression has type "Callable[[], str]", variable has type "def (int, /, *Any, **Any) -> str") [assignment] +callables_annotation.py:187: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "def (str, /, *Any, **Any) -> str") [assignment] +callables_annotation.py:189: error: Incompatible types in assignment (expression has type "Callable[[int, str], str]", variable has type "def (str, /, *Any, **Any) -> str") [assignment] """ conformance_automated = "Fail" errors_diff = """ diff --git a/conformance/results/mypy/callables_kwargs.toml b/conformance/results/mypy/callables_kwargs.toml index 39eaad11..f2203860 100644 --- a/conformance/results/mypy/callables_kwargs.toml +++ b/conformance/results/mypy/callables_kwargs.toml @@ -15,12 +15,12 @@ callables_kwargs.py:63: error: "func1" gets multiple values for keyword argument callables_kwargs.py:64: error: "func2" gets multiple values for keyword argument "v3" [misc] callables_kwargs.py:64: error: Argument 1 to "func2" has incompatible type "int"; expected "str" [arg-type] callables_kwargs.py:65: error: "func2" gets multiple values for keyword argument "v1" [misc] -callables_kwargs.py:101: error: Incompatible types in assignment (expression has type "Callable[[KwArg(TD2)], None]", variable has type "TDProtocol3") [assignment] -callables_kwargs.py:101: note: "TDProtocol3.__call__" has type "Callable[[NamedArg(int, 'v1'), NamedArg(int, 'v2'), NamedArg(str, 'v3')], None]" -callables_kwargs.py:102: error: Incompatible types in assignment (expression has type "Callable[[KwArg(TD2)], None]", variable has type "TDProtocol4") [assignment] -callables_kwargs.py:102: note: "TDProtocol4.__call__" has type "Callable[[NamedArg(int, 'v1')], None]" -callables_kwargs.py:103: error: Incompatible types in assignment (expression has type "Callable[[KwArg(TD2)], None]", variable has type "TDProtocol5") [assignment] -callables_kwargs.py:103: note: "TDProtocol5.__call__" has type "Callable[[Arg(int, 'v1'), Arg(str, 'v3')], None]" +callables_kwargs.py:101: error: Incompatible types in assignment (expression has type "def func1(**kwargs: Unpack[TD2]) -> None", variable has type "TDProtocol3") [assignment] +callables_kwargs.py:101: note: "TDProtocol3.__call__" has type "def __call__(self, *, v1: int, v2: int, v3: str) -> None" +callables_kwargs.py:102: error: Incompatible types in assignment (expression has type "def func1(**kwargs: Unpack[TD2]) -> None", variable has type "TDProtocol4") [assignment] +callables_kwargs.py:102: note: "TDProtocol4.__call__" has type "def __call__(self, *, v1: int) -> None" +callables_kwargs.py:103: error: Incompatible types in assignment (expression has type "def func1(**kwargs: Unpack[TD2]) -> None", variable has type "TDProtocol5") [assignment] +callables_kwargs.py:103: note: "TDProtocol5.__call__" has type "def __call__(self, v1: int, v3: str) -> None" callables_kwargs.py:111: error: Overlap between argument names and ** TypedDict items: "v1" [misc] callables_kwargs.py:122: error: Unpack item in ** argument must be a TypedDict [misc] """ diff --git a/conformance/results/mypy/callables_protocol.toml b/conformance/results/mypy/callables_protocol.toml index 0f2f4213..8fc8dcea 100644 --- a/conformance/results/mypy/callables_protocol.toml +++ b/conformance/results/mypy/callables_protocol.toml @@ -1,36 +1,36 @@ conformant = "Pass" output = """ -callables_protocol.py:35: error: Incompatible types in assignment (expression has type "Callable[[VarArg(bytes), NamedArg(int | None, 'max_items')], list[bytes]]", variable has type "Proto1") [assignment] -callables_protocol.py:35: note: "Proto1.__call__" has type "Callable[[VarArg(bytes), DefaultNamedArg(int | None, 'max_len')], list[bytes]]" -callables_protocol.py:36: error: Incompatible types in assignment (expression has type "Callable[[VarArg(bytes)], list[bytes]]", variable has type "Proto1") [assignment] -callables_protocol.py:36: note: "Proto1.__call__" has type "Callable[[VarArg(bytes), DefaultNamedArg(int | None, 'max_len')], list[bytes]]" -callables_protocol.py:37: error: Incompatible types in assignment (expression has type "Callable[[VarArg(bytes), NamedArg(str | None, 'max_len')], list[bytes]]", variable has type "Proto1") [assignment] -callables_protocol.py:37: note: "Proto1.__call__" has type "Callable[[VarArg(bytes), DefaultNamedArg(int | None, 'max_len')], list[bytes]]" -callables_protocol.py:67: error: Incompatible types in assignment (expression has type "Callable[[VarArg(bytes)], Any]", variable has type "Proto2") [assignment] -callables_protocol.py:67: note: "Proto2.__call__" has type "Callable[[VarArg(bytes), KwArg(str)], None]" -callables_protocol.py:68: error: Incompatible types in assignment (expression has type "Callable[[VarArg(str), KwArg(str)], Any]", variable has type "Proto2") [assignment] -callables_protocol.py:68: note: "Proto2.__call__" has type "Callable[[VarArg(bytes), KwArg(str)], None]" -callables_protocol.py:69: error: Incompatible types in assignment (expression has type "Callable[[VarArg(bytes), KwArg(bytes)], Any]", variable has type "Proto2") [assignment] -callables_protocol.py:69: note: "Proto2.__call__" has type "Callable[[VarArg(bytes), KwArg(str)], None]" -callables_protocol.py:70: error: Incompatible types in assignment (expression has type "Callable[[KwArg(str)], Any]", variable has type "Proto2") [assignment] -callables_protocol.py:70: note: "Proto2.__call__" has type "Callable[[VarArg(bytes), KwArg(str)], None]" +callables_protocol.py:35: error: Incompatible types in assignment (expression has type "def cb1_bad1(*vals: bytes, max_items: int | None) -> list[bytes]", variable has type "Proto1") [assignment] +callables_protocol.py:35: note: "Proto1.__call__" has type "def __call__(self, *vals: bytes, max_len: int | None = ...) -> list[bytes]" +callables_protocol.py:36: error: Incompatible types in assignment (expression has type "def cb1_bad2(*vals: bytes) -> list[bytes]", variable has type "Proto1") [assignment] +callables_protocol.py:36: note: "Proto1.__call__" has type "def __call__(self, *vals: bytes, max_len: int | None = ...) -> list[bytes]" +callables_protocol.py:37: error: Incompatible types in assignment (expression has type "def cb1_bad3(*vals: bytes, max_len: str | None) -> list[bytes]", variable has type "Proto1") [assignment] +callables_protocol.py:37: note: "Proto1.__call__" has type "def __call__(self, *vals: bytes, max_len: int | None = ...) -> list[bytes]" +callables_protocol.py:67: error: Incompatible types in assignment (expression has type "def cb2_bad1(*a: bytes) -> Any", variable has type "Proto2") [assignment] +callables_protocol.py:67: note: "Proto2.__call__" has type "def __call__(self, *vals: bytes, **kwargs: str) -> None" +callables_protocol.py:68: error: Incompatible types in assignment (expression has type "def cb2_bad2(*a: str, **b: str) -> Any", variable has type "Proto2") [assignment] +callables_protocol.py:68: note: "Proto2.__call__" has type "def __call__(self, *vals: bytes, **kwargs: str) -> None" +callables_protocol.py:69: error: Incompatible types in assignment (expression has type "def cb2_bad3(*a: bytes, **b: bytes) -> Any", variable has type "Proto2") [assignment] +callables_protocol.py:69: note: "Proto2.__call__" has type "def __call__(self, *vals: bytes, **kwargs: str) -> None" +callables_protocol.py:70: error: Incompatible types in assignment (expression has type "def cb2_bad4(**b: str) -> Any", variable has type "Proto2") [assignment] +callables_protocol.py:70: note: "Proto2.__call__" has type "def __call__(self, *vals: bytes, **kwargs: str) -> None" callables_protocol.py:97: error: Incompatible types in assignment (expression has type "Callable[[int], None]", variable has type "Proto4") [assignment] callables_protocol.py:97: note: "function" is missing following "Proto4" protocol member: callables_protocol.py:97: note: other_attribute -callables_protocol.py:121: error: Incompatible types in assignment (expression has type "Callable[[VarArg(bytes), DefaultNamedArg(int | None, 'max_len')], list[bytes]]", variable has type "NotProto6") [assignment] +callables_protocol.py:121: error: Incompatible types in assignment (expression has type "def cb6_bad1(*vals: bytes, max_len: int | None = ...) -> list[bytes]", variable has type "NotProto6") [assignment] callables_protocol.py:169: error: Incompatible types in assignment (expression has type "Callable[[int], Any]", variable has type "Proto8") [assignment] callables_protocol.py:169: note: "Proto8.__call__" has type overloaded function callables_protocol.py:186: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] callables_protocol.py:187: error: "Proto9[P, R]" has no attribute "xxx" [attr-defined] callables_protocol.py:197: error: "Proto9[[int], str]" has no attribute "other_attribute2"; maybe "other_attribute"? [attr-defined] callables_protocol.py:238: error: Incompatible types in assignment (expression has type "Callable[[int, str], Any]", variable has type "Proto11") [assignment] -callables_protocol.py:238: note: "Proto11.__call__" has type "Callable[[int, Arg(str, 'y')], Any]" -callables_protocol.py:260: error: Incompatible types in assignment (expression has type "Callable[[VarArg(Any), NamedArg(Any, 'kwarg0')], None]", variable has type "Proto12") [assignment] -callables_protocol.py:260: note: "Proto12.__call__" has type "Callable[[VarArg(Any), NamedArg(Any, 'kwarg0'), NamedArg(Any, 'kwarg1')], None]" +callables_protocol.py:238: note: "Proto11.__call__" has type "def __call__(self, int, /, y: str) -> Any" +callables_protocol.py:260: error: Incompatible types in assignment (expression has type "def cb12_bad1(*args: Any, kwarg0: Any) -> None", variable has type "Proto12") [assignment] +callables_protocol.py:260: note: "Proto12.__call__" has type "def __call__(self, *args: Any, kwarg0: Any, kwarg1: Any) -> None" callables_protocol.py:284: error: Incompatible types in assignment (expression has type "Callable[[str], str]", variable has type "Proto13_Default") [assignment] -callables_protocol.py:284: note: "Proto13_Default.__call__" has type "Callable[[DefaultArg(str, 'path')], str]" -callables_protocol.py:311: error: Incompatible types in assignment (expression has type "Callable[[NamedArg(str, 'path')], str]", variable has type "Proto14_Default") [assignment] -callables_protocol.py:311: note: "Proto14_Default.__call__" has type "Callable[[DefaultNamedArg(str, 'path')], str]" +callables_protocol.py:284: note: "Proto13_Default.__call__" has type "def __call__(self, path: str = ...) -> str" +callables_protocol.py:311: error: Incompatible types in assignment (expression has type "def cb14_no_default(*, path: str) -> str", variable has type "Proto14_Default") [assignment] +callables_protocol.py:311: note: "Proto14_Default.__call__" has type "def __call__(self, *, path: str = ...) -> str" """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/dataclasses_transform_converter.toml b/conformance/results/mypy/dataclasses_transform_converter.toml index cc316bee..fc5633e5 100644 --- a/conformance/results/mypy/dataclasses_transform_converter.toml +++ b/conformance/results/mypy/dataclasses_transform_converter.toml @@ -13,7 +13,7 @@ Line 121: Unexpected errors ['dataclasses_transform_converter.py:121: error: Arg """ output = """ dataclasses_transform_converter.py:48: error: Argument "converter" to "model_field" has incompatible type "Callable[[], int]"; expected "Callable[[Never], int]" [arg-type] -dataclasses_transform_converter.py:49: error: Argument "converter" to "model_field" has incompatible type "Callable[[NamedArg(int, 'x')], int]"; expected "Callable[[Never], int]" [arg-type] +dataclasses_transform_converter.py:49: error: Argument "converter" to "model_field" has incompatible type "def bad_converter2(*, x: int) -> int"; expected "Callable[[Never], int]" [arg-type] dataclasses_transform_converter.py:107: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type] dataclasses_transform_converter.py:107: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type] dataclasses_transform_converter.py:107: error: Argument 4 to "DC2" has incompatible type "bytes"; expected "ConverterClass" [arg-type] diff --git a/conformance/results/mypy/generics_paramspec_semantics.toml b/conformance/results/mypy/generics_paramspec_semantics.toml index eb5b744e..7dc429c7 100644 --- a/conformance/results/mypy/generics_paramspec_semantics.toml +++ b/conformance/results/mypy/generics_paramspec_semantics.toml @@ -3,14 +3,14 @@ output = """ generics_paramspec_semantics.py:26: error: Unexpected keyword argument "a" [call-arg] generics_paramspec_semantics.py:26: error: Unexpected keyword argument "b" [call-arg] generics_paramspec_semantics.py:27: error: Argument 2 has incompatible type "str"; expected "bool" [arg-type] -generics_paramspec_semantics.py:61: error: Argument 2 to "func1" has incompatible type "Callable[[NamedArg(int, 'y')], int]"; expected "Callable[[NamedArg(int, 'x')], int]" [arg-type] +generics_paramspec_semantics.py:61: error: Argument 2 to "func1" has incompatible type "def keyword_only_y(*, y: int) -> int"; expected "def (*, x: int) -> int" [arg-type] generics_paramspec_semantics.py:98: error: Argument 1 has incompatible type "int"; expected "str" [arg-type] generics_paramspec_semantics.py:108: error: Argument 1 has incompatible type "int"; expected "bool" [arg-type] generics_paramspec_semantics.py:120: error: Argument 1 has incompatible type "int"; expected "str" [arg-type] generics_paramspec_semantics.py:127: error: Argument 1 to "expects_int_first" has incompatible type "Callable[[str], int]"; expected "Callable[[int], int]" [arg-type] generics_paramspec_semantics.py:127: note: This is likely because "one" has named arguments: "x". Consider marking them positional-only -generics_paramspec_semantics.py:132: error: Argument 1 to "expects_int_first" has incompatible type "Callable[[NamedArg(int, 'x')], int]"; expected "Callable[[int, NamedArg(int, 'x')], int]" [arg-type] -generics_paramspec_semantics.py:137: error: Argument 1 to "expects_int_first" has incompatible type "Callable[[KwArg(int)], int]"; expected "Callable[[int, KwArg(int)], int]" [arg-type] +generics_paramspec_semantics.py:132: error: Argument 1 to "expects_int_first" has incompatible type "def two(*, x: int) -> int"; expected "def (int, /, *, x: int) -> int" [arg-type] +generics_paramspec_semantics.py:137: error: Argument 1 to "expects_int_first" has incompatible type "def three(**kwargs: int) -> int"; expected "def (int, /, **kwargs: int) -> int" [arg-type] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/generics_syntax_scoping.toml b/conformance/results/mypy/generics_syntax_scoping.toml index 1d6ad3e6..2e249720 100644 --- a/conformance/results/mypy/generics_syntax_scoping.toml +++ b/conformance/results/mypy/generics_syntax_scoping.toml @@ -3,8 +3,7 @@ notes = """ Does not following runtime scoping rules for type parameters in all cases. """ output = """ -generics_syntax_scoping.py:14: error: Variable "generics_syntax_scoping.S" is not valid as a type [valid-type] -generics_syntax_scoping.py:14: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases +generics_syntax_scoping.py:14: error: Name "S" is not defined [name-defined] generics_syntax_scoping.py:18: error: Variable "generics_syntax_scoping.T" is not valid as a type [valid-type] generics_syntax_scoping.py:18: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases generics_syntax_scoping.py:35: error: Cannot determine type of "T" [has-type] diff --git a/conformance/results/mypy/narrowing_typeguard.toml b/conformance/results/mypy/narrowing_typeguard.toml index 12cc80af..4c4f0952 100644 --- a/conformance/results/mypy/narrowing_typeguard.toml +++ b/conformance/results/mypy/narrowing_typeguard.toml @@ -4,7 +4,7 @@ narrowing_typeguard.py:102: error: TypeGuard functions must have a positional ar narrowing_typeguard.py:107: error: TypeGuard functions must have a positional argument [valid-type] narrowing_typeguard.py:128: error: Argument 1 to "takes_callable_str" has incompatible type "Callable[[object], TypeGuard[int]]"; expected "Callable[[object], str]" [arg-type] narrowing_typeguard.py:148: error: Argument 1 to "takes_callable_str_proto" has incompatible type "Callable[[object], TypeGuard[int]]"; expected "CallableStrProto" [arg-type] -narrowing_typeguard.py:148: note: "CallableStrProto.__call__" has type "Callable[[Arg(object, 'val')], str]" +narrowing_typeguard.py:148: note: "CallableStrProto.__call__" has type "def __call__(self, val: object) -> str" """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/narrowing_typeis.toml b/conformance/results/mypy/narrowing_typeis.toml index b913aa17..5000a5bf 100644 --- a/conformance/results/mypy/narrowing_typeis.toml +++ b/conformance/results/mypy/narrowing_typeis.toml @@ -4,7 +4,7 @@ narrowing_typeis.py:105: error: "TypeIs" functions must have a positional argume narrowing_typeis.py:110: error: "TypeIs" functions must have a positional argument [valid-type] narrowing_typeis.py:132: error: Argument 1 to "takes_callable_str" has incompatible type "Callable[[object], TypeIs[int]]"; expected "Callable[[object], str]" [arg-type] narrowing_typeis.py:152: error: Argument 1 to "takes_callable_str_proto" has incompatible type "Callable[[object], TypeIs[int]]"; expected "CallableStrProto" [arg-type] -narrowing_typeis.py:152: note: "CallableStrProto.__call__" has type "Callable[[Arg(object, 'val')], str]" +narrowing_typeis.py:152: note: "CallableStrProto.__call__" has type "def __call__(self, val: object) -> str" narrowing_typeis.py:169: error: Argument 1 to "takes_typeguard" has incompatible type "Callable[[object], TypeIs[int]]"; expected "Callable[[object], TypeGuard[int]]" [arg-type] narrowing_typeis.py:170: error: Argument 1 to "takes_typeis" has incompatible type "Callable[[object], TypeGuard[int]]"; expected "Callable[[object], TypeIs[int]]" [arg-type] narrowing_typeis.py:191: error: Argument 1 to "takes_int_typeis" has incompatible type "Callable[[object], TypeIs[bool]]"; expected "Callable[[object], TypeIs[int]]" [arg-type] diff --git a/conformance/results/mypy/typeddicts_type_consistency.toml b/conformance/results/mypy/typeddicts_type_consistency.toml index e0e0ba7f..3ddab2c9 100644 --- a/conformance/results/mypy/typeddicts_type_consistency.toml +++ b/conformance/results/mypy/typeddicts_type_consistency.toml @@ -8,8 +8,6 @@ typeddicts_type_consistency.py:76: error: Incompatible types in assignment (expr typeddicts_type_consistency.py:77: error: Incompatible types in assignment (expression has type "B3", variable has type "dict[str, object]") [assignment] typeddicts_type_consistency.py:78: error: Incompatible types in assignment (expression has type "B3", variable has type "dict[Any, Any]") [assignment] typeddicts_type_consistency.py:82: error: Incompatible types in assignment (expression has type "B3", variable has type "Mapping[str, int]") [assignment] -typeddicts_type_consistency.py:101: error: Incompatible types in assignment (expression has type "str | None", variable has type "str") [assignment] -typeddicts_type_consistency.py:107: error: Incompatible types in assignment (expression has type "int | str", variable has type "int") [assignment] typeddicts_type_consistency.py:126: error: Incompatible types (expression has type "int", TypedDict item "inner_key" has type "str") [typeddict-item] """ conformance_automated = "Pass" diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 7ce901e6..e0afe12c 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1 +1 @@ -version = "mypy 1.18.2" +version = "mypy 1.19.0" diff --git a/conformance/results/pyrefly/generics_typevartuple_concat.toml b/conformance/results/pyrefly/generics_typevartuple_concat.toml index 042e0a2e..f9ba600b 100644 --- a/conformance/results/pyrefly/generics_typevartuple_concat.toml +++ b/conformance/results/pyrefly/generics_typevartuple_concat.toml @@ -4,8 +4,8 @@ Fails to handle move_first_element_to_last example """ conformance_automated = "Fail" errors_diff = """ -Line 56: Unexpected errors ['Returned type `tuple[*tuple[object | T, ...], object | T]` is not assignable to declared return type `tuple[*Ts, T]` [bad-return]'] +Line 56: Unexpected errors ['Returned type `tuple[*tuple[T | ElementOf[Ts], ...], T | ElementOf[Ts]]` is not assignable to declared return type `tuple[*Ts, T]` [bad-return]'] """ output = """ -ERROR generics_typevartuple_concat.py:56:12-30: Returned type `tuple[*tuple[object | T, ...], object | T]` is not assignable to declared return type `tuple[*Ts, T]` [bad-return] +ERROR generics_typevartuple_concat.py:56:12-30: Returned type `tuple[*tuple[T | ElementOf[Ts], ...], T | ElementOf[Ts]]` is not assignable to declared return type `tuple[*Ts, T]` [bad-return] """ diff --git a/conformance/results/pyrefly/version.toml b/conformance/results/pyrefly/version.toml index 51bc5668..13ffc21b 100644 --- a/conformance/results/pyrefly/version.toml +++ b/conformance/results/pyrefly/version.toml @@ -1 +1 @@ -version = "pyrefly 0.42.3" +version = "pyrefly 0.43.1" diff --git a/conformance/results/results.html b/conformance/results/results.html index 0fe3276b..4fcd70e7 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -158,13 +158,13 @@

Python Type System Conformance Test Results

- -
 
mypy 1.18.2
+
mypy 1.19.0
pyright 1.1.407
zuban 0.2.3
pyrefly 0.42.3
+
pyrefly 0.43.1