From 32285b38298db9d30f63810ace16ff7e5a54ab37 Mon Sep 17 00:00:00 2001 From: Rebecca Chen Date: Tue, 31 Mar 2026 11:23:52 -0700 Subject: [PATCH] Add --min-severity=warn to pyrefly command --- .../pyrefly/directives_deprecated.toml | 28 +++++++++---------- .../results/pyrefly/protocols_variance.toml | 17 +++++------ conformance/results/results.html | 4 +-- conformance/src/type_checker.py | 2 +- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/conformance/results/pyrefly/directives_deprecated.toml b/conformance/results/pyrefly/directives_deprecated.toml index 2b3718261..9373c54f4 100644 --- a/conformance/results/pyrefly/directives_deprecated.toml +++ b/conformance/results/pyrefly/directives_deprecated.toml @@ -1,18 +1,18 @@ -conformant = "Unsupported" -conformance_automated = "Fail" +conformant = "Pass" +conformance_automated = "Pass" errors_diff = """ -Line 18: Expected 1 errors -Line 24: Expected 1 errors -Line 25: Expected 1 errors -Line 30: Expected 1 errors -Line 41: Expected 1 errors -Line 42: Expected 1 errors -Line 44: Expected 1 errors -Line 47: Expected 1 errors -Line 48: Expected 1 errors -Line 58: Expected 1 errors -Line 69: Expected 1 errors -Line 98: Expected 1 errors """ output = """ + WARN directives_deprecated.py:18:44-47: `Ham` is deprecated [deprecated] + WARN directives_deprecated.py:24:1-23: `_directives_deprecated_library.norwegian_blue` is deprecated [deprecated] + WARN directives_deprecated.py:25:5-27: `_directives_deprecated_library.norwegian_blue` is deprecated [deprecated] + WARN directives_deprecated.py:30:12-15: Call to deprecated overload `_directives_deprecated_library.foo` [deprecated] + WARN directives_deprecated.py:41:5-13: `+` is not supported between `Spam` and `Literal[1]` [deprecated] + WARN directives_deprecated.py:42:1-10: `+=` is not supported between `Spam` and `Literal[1]` [deprecated] + WARN directives_deprecated.py:44:1-12: `_directives_deprecated_library.Spam.greasy` is deprecated [deprecated] + WARN directives_deprecated.py:47:1-11: `_directives_deprecated_library.Spam.shape` is deprecated [deprecated] + WARN directives_deprecated.py:48:1-11: `_directives_deprecated_library.Spam.shape` is deprecated [deprecated] + WARN directives_deprecated.py:58:1-10: `Invocable.__call__` is deprecated [deprecated] + WARN directives_deprecated.py:69:1-6: `lorem` is deprecated [deprecated] + WARN directives_deprecated.py:98:5-10: `SupportsFoo1.foo` is deprecated [deprecated] """ diff --git a/conformance/results/pyrefly/protocols_variance.toml b/conformance/results/pyrefly/protocols_variance.toml index 71f9bf5d4..b91c48cac 100644 --- a/conformance/results/pyrefly/protocols_variance.toml +++ b/conformance/results/pyrefly/protocols_variance.toml @@ -1,16 +1,13 @@ -conformant = "Partial" -notes = """ -Does not detect Protocol type parameters with wrong variance. -""" -conformance_automated = "Fail" +conformant = "Pass" +conformance_automated = "Pass" errors_diff = """ -Line 21: Expected 1 errors -Line 40: Expected 1 errors -Line 56: Expected 1 errors -Line 66: Expected 1 errors -Line 104: Expected 1 errors """ output = """ + WARN protocols_variance.py:21:7-17: Type variable `T1` in class `AnotherBox` is declared as invariant, but could be covariant based on its usage [variance-mismatch] + WARN protocols_variance.py:40:7-16: Type variable `T3` in class `Protocol2` is declared as invariant, but could be contravariant based on its usage [variance-mismatch] + WARN protocols_variance.py:56:7-16: Type variable `T1` in class `Protocol4` is declared as invariant, but could be contravariant based on its usage [variance-mismatch] ERROR protocols_variance.py:62:9-11: Type variable `T1_co` is Covariant but is used in contravariant position [invalid-variance] + WARN protocols_variance.py:66:7-16: Type variable `T1` in class `Protocol6` is declared as invariant, but could be covariant based on its usage [variance-mismatch] ERROR protocols_variance.py:72:9-11: Type variable `T1_contra` is Contravariant but is used in covariant position [invalid-variance] + WARN protocols_variance.py:104:7-17: Type variable `T1` in class `Protocol12` is declared as invariant, but could be covariant based on its usage [variance-mismatch] """ diff --git a/conformance/results/results.html b/conformance/results/results.html index cce6de3bd..144d63f26 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -683,7 +683,7 @@

Python Type System Conformance Test Results

Pass Pass Pass -
Partial

Does not detect Protocol type parameters with wrong variance.

+Pass Unsupported @@ -1164,7 +1164,7 @@

Python Type System Conformance Test Results

Pass Pass Pass -Unsupported +Pass
Partial

Does not detect calls to deprecated overloads.

Does not detect implicit calls to deprecated dunder methods, for example via operators.

Does not detect accesses of, or attempts to set, deprecated properties.

     directives_no_type_check diff --git a/conformance/src/type_checker.py b/conformance/src/type_checker.py index 92ee2cb91..7d90148aa 100644 --- a/conformance/src/type_checker.py +++ b/conformance/src/type_checker.py @@ -326,7 +326,7 @@ def get_version(self) -> str: def run_tests(self, test_files: Sequence[str]) -> dict[str, str]: proc = run( - ["pyrefly", "check", "--output-format", "min-text", "--summary=none"], + ["pyrefly", "check", "--output-format", "min-text", "--summary=none", "--min-severity=warn"], stdout=PIPE, text=True, encoding="utf-8",