Skip to content

Comments

[ty] Disallow TypeVars within ClassVars#23184

Merged
charliermarsh merged 1 commit intomainfrom
charlie/typevar
Feb 9, 2026
Merged

[ty] Disallow TypeVars within ClassVars#23184
charliermarsh merged 1 commit intomainfrom
charlie/typevar

Conversation

@charliermarsh
Copy link
Member

Summary

Closes astral-sh/ty#518.

@charliermarsh charliermarsh added the ty Multi-file analysis & type inference label Feb 9, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 9, 2026

Typing conformance results improved 🎉

The percentage of diagnostics emitted that were expected errors increased from 82.38% to 82.43%. The percentage of expected errors that received a diagnostic increased from 73.01% to 73.29%.

Summary

Metric Old New Diff Outcome
True Positives 790 793 +3 ⏫ (✅)
False Positives 169 169 +0
False Negatives 292 289 -3 ⏬ (✅)
Total Diagnostics 959 962 +3
Precision 82.38% 82.43% +0.05% ⏫ (✅)
Recall 73.01% 73.29% +0.28% ⏫ (✅)

True positives added

Details
Location Name Message
classes_classvar.py:45:11 invalid-type-form ClassVar cannot contain type variables
classes_classvar.py:46:11 invalid-type-form ClassVar cannot contain type variables
classes_classvar.py:47:11 invalid-type-form ClassVar cannot contain type variables

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 9, 2026

mypy_primer results

Changes were detected when running on open source projects
artigraph (https://github.com/artigraph/artigraph)
+ src/arti/internal/mappings.py:100:22: error[invalid-type-form] `ClassVar` cannot contain type variables
- src/arti/storage/__init__.py:74:49: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

Expression (https://github.com/cognitedata/Expression)
- tests/test_compose.py:21:16: error[invalid-assignment] Object of type `(Never, /) -> Never` is not assignable to `(int, /) -> int`
- Found 205 diagnostics
+ Found 204 diagnostics

comtypes (https://github.com/enthought/comtypes)
- comtypes/hints.pyi:53:32: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 491 diagnostics
+ Found 490 diagnostics

strawberry (https://github.com/strawberry-graphql/strawberry)
+ strawberry/types/base.py:202:32: error[invalid-type-form] `ClassVar` cannot contain type variables
- Found 344 diagnostics
+ Found 345 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/build/wheel.py:99:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 50 diagnostics
+ Found 49 diagnostics

hydpy (https://github.com/hydpy-dev/hydpy)
+ hydpy/core/variabletools.py:2449:29: error[invalid-type-form] `ClassVar` cannot contain type variables
- Found 672 diagnostics
+ Found 673 diagnostics

sympy (https://github.com/sympy/sympy)
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
- sympy/functions/combinatorial/factorials.py:967:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/functions/combinatorial/factorials.py:967:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:968:29: warning[possibly-missing-attribute] Attribute `is_nonnegative` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:968:47: warning[possibly-missing-attribute] Attribute `is_integer` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:969:12: warning[possibly-missing-attribute] Attribute `is_zero` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:972:13: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:972:13: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:975:12: warning[possibly-missing-attribute] Attribute `is_integer` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:976:16: warning[possibly-missing-attribute] Attribute `is_negative` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:978:18: warning[possibly-missing-attribute] Attribute `is_number` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:984:14: warning[possibly-missing-attribute] Attribute `is_number` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:986:26: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:986:26: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:986:40: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:986:40: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:986:53: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/functions/combinatorial/factorials.py:986:53: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/geometry/polygon.py:1500:12: warning[possibly-missing-attribute] Attribute `is_Number` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/geometry/polygon.py:1501:20: error[invalid-argument-type] Argument to function `as_int` is incorrect: Expected `SupportsIndex`, found `Basic`
+ sympy/geometry/polygon.py:1501:20: error[invalid-argument-type] Argument to function `as_int` is incorrect: Expected `SupportsIndex`, found `Basic | int | float | complex | Any`
- sympy/geometry/polygon.py:1502:16: error[unsupported-operator] Operator `<` is not supported between objects of type `Basic` and `Literal[3]`
+ sympy/geometry/polygon.py:1502:16: error[unsupported-operator] Operator `<` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[3]`
+ sympy/geometry/polygon.py:1509:40: warning[possibly-missing-attribute] Attribute `is_number` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/matrices/eigen.py:1202:37: error[unresolved-attribute] Object of type `T2'return@call_highest_priority | T1'return@call_highest_priority` has no attribute `pow`
+ sympy/matrices/eigen.py:1202:37: error[unresolved-attribute] Object of type `T1'return@call_highest_priority | T2'return@call_highest_priority` has no attribute `pow`
- sympy/matrices/matrixbase.py:2957:16: error[invalid-return-type] Return type does not match returned value: expected `Self@_eval_pow_by_cayley`, found `Self@_eval_pow_by_cayley | T2'return@call_highest_priority | T1'return@call_highest_priority`
+ sympy/matrices/matrixbase.py:2957:16: error[invalid-return-type] Return type does not match returned value: expected `Self@_eval_pow_by_cayley`, found `Self@_eval_pow_by_cayley | T1'return@call_highest_priority | T2'return@call_highest_priority`
- sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
+ sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority`
- sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T2'return@call_highest_priority | T1'return@call_highest_priority`, found `MatrixBase`
+ sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T1'return@call_highest_priority | T2'return@call_highest_priority`, found `MatrixBase`
- sympy/matrices/matrixbase.py:4923:16: error[invalid-return-type] Return type does not match returned value: expected `Self@analytic_func`, found `Self@analytic_func | T2'return@call_highest_priority | T1'return@call_highest_priority`
+ sympy/matrices/matrixbase.py:4923:16: error[invalid-return-type] Return type does not match returned value: expected `Self@analytic_func`, found `Self@analytic_func | T1'return@call_highest_priority | T2'return@call_highest_priority`
+ sympy/parsing/mathematica.py:692:38: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `Unknown | list[Unknown | str]`
- sympy/physics/optics/gaussopt.py:263:56: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:263:56: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:298:54: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:298:54: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:298:69: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:298:69: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:707:12: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic` and `Literal[2]`
+ sympy/physics/optics/gaussopt.py:707:12: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
+ sympy/physics/optics/gaussopt.py:756:8: warning[possibly-missing-attribute] Attribute `is_infinite` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:756:25: warning[possibly-missing-attribute] Attribute `is_infinite` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:757:21: warning[possibly-missing-attribute] Attribute `is_infinite` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:759:16: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:759:16: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:759:21: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:759:21: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:790:34: error[unsupported-operator] Unary operator `-` is not supported for object of type `Basic`
+ sympy/physics/optics/gaussopt.py:790:34: error[unsupported-operator] Unary operator `-` is not supported for object of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:837:30: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic` and `Literal[2]`
+ sympy/physics/optics/gaussopt.py:837:30: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
- sympy/physics/optics/gaussopt.py:837:41: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:837:41: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:837:54: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Basic`
+ sympy/physics/optics/gaussopt.py:837:54: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:838:22: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:838:22: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:838:37: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:838:37: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:839:31: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:839:31: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:839:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:839:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:887:9: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/physics/optics/gaussopt.py:887:9: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/quantum/cg.py:83:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
+ sympy/physics/quantum/cg.py:258:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
+ sympy/physics/quantum/cg.py:347:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:5998:12: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:5998:31: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:5998:51: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:5998:70: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:5999:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/polys/polytools.py:5999:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:6128:12: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:6128:31: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:6128:51: warning[possibly-missing-attribute] Attribute `is_algebraic` may be missing on object of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:6128:70: warning[possibly-missing-attribute] Attribute `is_irrational` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6129:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/polys/polytools.py:6129:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/series/formal.py:987:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
+ sympy/series/fourier.py:146:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
+ sympy/simplify/sqrtdenest.py:430:25: warning[possibly-missing-attribute] Attribute `subs` may be missing on object of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:361:32: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:361:32: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:362:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:362:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:363:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:363:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:363:52: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:363:52: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:363:62: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:363:62: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:363:70: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:363:70: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:365:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic` and `Literal[2]`
+ sympy/stats/tests/test_finite_rv.py:365:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
- sympy/stats/tests/test_finite_rv.py:365:30: error[unsupported-operator] Operator `<` is not supported between objects of type `Literal[0]` and `Basic`
+ sympy/stats/tests/test_finite_rv.py:365:30: error[unsupported-operator] Operator `<` is not supported between objects of type `Literal[0]` and `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:365:34: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:365:34: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:365:44: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:365:44: error[unsupported-operator] Operator `<` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:366:57: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic`
+ sympy/stats/tests/test_finite_rv.py:366:57: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:366:67: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:366:67: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:366:79: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic`
+ sympy/stats/tests/test_finite_rv.py:366:79: error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[2]` and `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:367:33: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:367:33: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:367:38: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:367:38: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:367:46: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
+ sympy/stats/tests/test_finite_rv.py:367:46: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
- sympy/stats/tests/test_finite_rv.py:367:55: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[2]`
+ sympy/stats/tests/test_finite_rv.py:367:55: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
- Found 15880 diagnostics
+ Found 15907 diagnostics

@charliermarsh charliermarsh marked this pull request as ready for review February 9, 2026 21:29
@charliermarsh
Copy link
Member Author

I believe these are true positives:

artigraph (https://github.com/artigraph/artigraph)
+ src/arti/internal/mappings.py:100:22: error[invalid-type-form] `ClassVar` cannot contain type variables

strawberry (https://github.com/strawberry-graphql/strawberry)
+ strawberry/types/base.py:202:32: error[invalid-type-form] `ClassVar` cannot contain type variables

hydpy (https://github.com/hydpy-dev/hydpy)
+ hydpy/core/variabletools.py:2449:29: error[invalid-type-form] `ClassVar` cannot contain type variables

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@AlexWaygood
Copy link
Member

I believe these are true positives:

yep, agreed

@charliermarsh charliermarsh merged commit b680d5f into main Feb 9, 2026
50 checks passed
@charliermarsh charliermarsh deleted the charlie/typevar branch February 9, 2026 22:04
carljm added a commit to Hugo-Polloli/ruff that referenced this pull request Feb 9, 2026
* main:
  [ty] Detect flaky projects during ecosystem CI jobs (astral-sh#23178)
  [ty] Disallow TypeVars within ClassVars (astral-sh#23184)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClassVar shouldn't be allowed to contain type variables

2 participants