Skip to content

Handling duplicates to avoid non-deterministic resolution behavior #5

Description

@zaebee

src/cgis/resolver/engine.py

            if node.type in (NodeType.FUNCTION, NodeType.CLASS):
                # We use the name as a key for direct calls, allowing multiple candidates
                self._global_symbols.setdefault(node.name, []).append(node.id)
                self._file_global_symbols[(os.path.normpath(node.file_path), node.name)] = node.id

medium

If a file contains multiple global symbols with the same name (e.g., due to conditional definitions or overloading), the dictionary _file_global_symbols will silently overwrite previous entries with the last one processed. Consider storing a list of FQNs (similar to _global_symbols) or handling duplicates to avoid non-deterministic resolution behavior.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions