[Lldb-commits] [lldb] [LLDB]Fix logic in matches method for thread comparison (PR #179873)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 9 02:12:55 PST 2026


================
@@ -15,7 +15,7 @@ class TestDAP_stopped_events(lldbdap_testcase.DAPTestCaseBase):
     ANY_THREAD = {}
 
     def matches(self, a: dict, b: dict) -> bool:
-        """Returns true if 'a' is a subset of 'b', otherwise false."""
+        """Returns true if 'b' is a subset of 'a', otherwise false."""
         return a | b == a
----------------
JDevlieghere wrote:

I think this method as currently written is too cryptic:

1. The name of the function is wrong or at least needlessly confusing. 
2. The name of the variables makes things worse. 

Assuming the code is correct (and not the comment), I would prefer:

```
def is_subdict(self, small: dict, big: dict) -> bool:
  """Returns true if 'small' is a subset of 'big', otherwise false."""
  return big | small == big
```

And updating the relevant call sites. 

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


More information about the lldb-commits mailing list