[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:
Alex Waygood
2025-08-29 18:43:30 +01:00
committed by GitHub
parent fa7798ddd9
commit 9b1b58a451
6 changed files with 15 additions and 15 deletions

View File

@@ -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}` \