[ty] Revert protocol ClassVar declaration requirement - #27726
Conversation
…)" This reverts commit 64021cf.
Typing conformance results regressed ❌The percentage of diagnostics emitted that were expected errors decreased from 97.14% to 97.14%. The percentage of expected errors that received a diagnostic decreased from 93.44% to 93.43%. The number of fully passing files held steady at 107/137. SummaryHow are test cases classified?Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (
Test file breakdown2 files altered
Optional Diagnostics Removed (2)2 diagnostics
|
|
Bah, we gotta fix our typing-conformance script so it doesn't display those demotivating ❌ emojis if the only diagnostics removed are optional diagnostics 😆 |
Memory usage reportMemory usage unchanged ✅ |
|
Ummmmm, I have no idea why there's no ecosystem-analyzer comment here, but the uploaded report at https://github.com/astral-sh/ruff/actions/runs/31708813786?pr=27726 says that there's no ecosystem changes |
| # An instance declaration does not become a class variable without an explicit qualifier. | ||
| static_assert(not is_subtype_of(Foo, HasClassVarX)) | ||
| static_assert(not is_assignable_to(Foo, HasClassVarX)) | ||
| # TODO: these should pass |
There was a problem hiding this comment.
Can you explain whether this is still a TODO? (And, if so, why revert?)
Reverts #27530.
Restore the previous protocol-matching behavior so any type
Tcan satisfy a protocol with aClassVarmemberxifTis readable on instances ofT, and both readable and writable ontype[T].Cf. python/typing#2340