[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 14 17:28:20 PDT 2024


================
@@ -65,6 +65,9 @@ Clang Python Bindings Potentially Breaking Changes
 - Calling a property on the ``CompletionChunk`` or ``CompletionString`` class
   statically now leads to an error, instead of returning a ``CachedProperty`` object
   that is used internally. Properties are only available on instances.
+- If ``SourceRange.__contains__`` is used with a single-line ``SourceRange``, the check used
+  to return ``True`` if the end of the ``SourceLocation`` lay after the end of the ``SourceRange``
+  on the same line. This is changed to return ``False`` now.
----------------
Endilll wrote:

Here's a different phrasing, hopefully better:
```rest
- For a single-line ``SourceRange`` and a ``SourceLocation`` at the same line,
  but after the end of the ``SourceRange``, ``SourceRange.__contains__``
  used to incorrectly return ``True``. This is changed to return ``False`` now.
```

https://github.com/llvm/llvm-project/pull/101802


More information about the cfe-commits mailing list