From f4f6e8fbbe78d3a27f3a1011bff36fdcf0cffe79 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Thu, 29 May 2025 14:31:38 +0200 Subject: [PATCH] Revert "Hotfix: fix equality check of SymbolLocation" This reverts commit ba1a613bc9c0178db06229686008c9fe809be17a. --- src/serena/symbol.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/serena/symbol.py b/src/serena/symbol.py index 14acc579..3178d553 100644 --- a/src/serena/symbol.py +++ b/src/serena/symbol.py @@ -17,7 +17,7 @@ if TYPE_CHECKING: log = logging.getLogger(__name__) -@dataclass(eq=False) +@dataclass class SymbolLocation: """ Represents the location of a symbol, including the line where the identifier @@ -59,17 +59,6 @@ class SymbolLocation: def has_position_in_file(self) -> bool: return self.relative_path is not None and self.line is not None and self.column is not None - def matches_identifier_location(self, other: Self) -> bool: - """ - Checks if this instance matches a symbol identifier location. - Since symbol identifiers are only concerned with the start position, - the end_line is not taken into account. - """ - if self.relative_path is None: - # not defined locations don't match anything - return False - return self.relative_path == other.relative_path and self.line == other.line and self.column == other.column - class Symbol(ToStringMixin): _NAME_PATH_SEP = "/" @@ -379,7 +368,7 @@ class SymbolManager: symbol_dicts, roots = self.lang_server.request_document_symbols(location.relative_path, include_body=False) for symbol_dict in symbol_dicts: symbol = Symbol(symbol_dict) - if symbol.location.matches_identifier_location(location): + if symbol.location == location: return symbol return None