[clang] [libclang/python] Fix bug in `SourceRange.__contains__`, add tests (PR #101802)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 7 12:04:25 PDT 2024
================
@@ -386,6 +386,10 @@ def __contains__(self, other):
# same file, in between lines
if self.start.line < other.line < self.end.line:
return True
+ # between columns in one-liner range
+ elif self.start.line == other.line == self.end.line:
----------------
Endilll wrote:
Is there a reason you implemented _less-or-equals_ operator, and not _less_? `operator<` + `operator==` is sort of a canonical pair of operators to establish ordering, and it would match `SourceLocation` in C++.
https://github.com/llvm/llvm-project/pull/101802
More information about the cfe-commits
mailing list