Skip to content

Commit b593927

Browse files
samwgoldmanfacebook-github-bot
authored andcommitted
Simplify excluding object fields from completions
Summary: Instead of getting mro ancestors with object, then filtering it out, just don't include it in the first place. Reviewed By: stroxler Differential Revision: D80887807 fbshipit-source-id: 0b955afd2347eb714928c2b2f48203d61d2ba60c
1 parent 9c660a7 commit b593927

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pyrefly/lib/alt/attr.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,11 +2090,8 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
20902090
) {
20912091
let mro = self.get_mro_for_class(cls);
20922092
let mut seen = SmallSet::new();
2093-
for c in iter::once(cls).chain(mro.ancestors(self.stdlib).map(|x| x.class_object())) {
2094-
if c == self.stdlib.object().class_object() {
2095-
// Don't want to suggest `__hash__`
2096-
break;
2097-
}
2093+
// NOTE: We do not provide completions from object, to avoid noise like __hash__. Maybe we should?
2094+
for c in iter::once(cls).chain(mro.ancestors_no_object().iter().map(|x| x.class_object())) {
20982095
match expected_attribute_name {
20992096
None => {
21002097
for fld in c.fields() {

0 commit comments

Comments
 (0)