mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-29 06:46:49 +08:00
fix(python): a member value through an untyped receiver is a method only its owner names (#2218)
A lone project method now stands for an untyped receiver's member value only when the receiver is named after the method's class: netbox's `device=self.parent.device` model-field reads no longer reach a GraphQL filter's `device` method. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fa43e259b2
commit
e62032e95a
@@ -325,8 +325,14 @@ function matchMemberFunctionRef(ref: UnresolvedRef, context: ResolutionContext):
|
||||
}
|
||||
}
|
||||
// Unknown receivers retain the old unique-or-drop discipline, across ALL
|
||||
// files. Tests and abstract-looking bodies are candidates too.
|
||||
return result(context.getNodesByName(member), 0.8);
|
||||
// files. Tests and abstract-looking bodies are candidates too. A lone method
|
||||
// stands only when the receiver is named after its owner: netbox's
|
||||
// `device=self.parent.device` is a model field, not the project's one
|
||||
// `device` method (a GraphQL filter's). A veto, never a filter — filtering
|
||||
// first would promote some other lone match into a new guess.
|
||||
const unique = result(context.getNodesByName(member), 0.8);
|
||||
const target = unique ? context.getNodeById?.(unique.targetNodeId) : null;
|
||||
return target && target.kind === 'method' && !sharesReceiverWord(receiverLink(receiver), target) ? null : unique;
|
||||
}
|
||||
|
||||
function pythonRefClass(name: string, ref: UnresolvedRef, context: ResolutionContext): Node | null {
|
||||
|
||||
Reference in New Issue
Block a user