mirror of
https://github.com/astral-sh/ruff
synced 2026-01-09 23:54:36 -05:00
[ty] Use invalid-assignment error code for invalid assignments to ClassVars (#20156)
## Summary This error is about assigning to attributes rather than reading attributes, so I think `invalid-assignment` makes more sense than `invalid-attribute-access` ## Test Plan existing mdtests updated
This commit is contained in:
@@ -4195,7 +4195,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
||||
meta_attr @ PlaceAndQualifiers { .. } if meta_attr.is_class_var() => {
|
||||
if emit_diagnostics {
|
||||
if let Some(builder) =
|
||||
self.context.report_lint(&INVALID_ATTRIBUTE_ACCESS, target)
|
||||
self.context.report_lint(&INVALID_ASSIGNMENT, target)
|
||||
{
|
||||
builder.into_diagnostic(format_args!(
|
||||
"Cannot assign to ClassVar `{attribute}` \
|
||||
|
||||
Reference in New Issue
Block a user