You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a class defines __slots__, pyrefly shouldn't allow writing to attributes that aren't specified in __slots__. This is tested in the dataclasses_slots conformance test, which we currently fail:
I've been thinking about this and __match_args__ which has similar properties.
I was thinking we should try and compute these while solving class metadata and store it as something better than Type::Tuple([Type::Literal(...), Type::Literal(...)].
Thanks a lot! As we discussed, this PR still has some open questions regarding whether the errors it introduced are false positives or not and had not been active for sometime, unless @Adist319 would still like to look into the false positives, I can take it and/or open to the community
Activity
yangdanny97 commentedon Jul 4, 2025
I've been thinking about this and
__match_args__which has similar properties.I was thinking we should try and compute these while solving class metadata and store it as something better than
Type::Tuple([Type::Literal(...), Type::Literal(...)].Support `slots=True`
Adist319 commentedon Jan 6, 2026
I can take a look at this!
rchen152 commentedon Jan 7, 2026
Assigned, thank you!
Adist319 commentedon Jan 7, 2026
PR created here: #2029
migeed-z commentedon Feb 5, 2026
Thanks a lot! As we discussed, this PR still has some open questions regarding whether the errors it introduced are false positives or not and had not been active for sometime, unless @Adist319 would still like to look into the false positives, I can take it and/or open to the community
missing-attributewhen valid class attribute is included in__slots__#2444Enforce __slots__ validation for attribute writes (facebook#2695)
Add github workflow for v1 issue ranking
Enforce __slots__ validation for attribute writes (facebook#2695)
Enforce __slots__ validation for attribute writes (facebook#2695)
Add github workflow for v1 issue ranking