Use hasLocationInfo to match several Location fields at once

This commit is contained in:
Chris Smowton
2022-08-19 19:02:05 +01:00
parent 3266f1f35f
commit 8d20b9cf52
8 changed files with 24 additions and 24 deletions

View File

@@ -331,15 +331,15 @@ abstract private class Expectation extends FailureLocatable {
}
private predicate onSameLine(ValidExpectation a, ActualResult b) {
exists(File f, int line, Location la, Location lb |
exists(string fname, int line, Location la, Location lb |
// Join order intent:
// Take the locations of ActualResults,
// join with locations in the same file / on the same line,
// then match those against ValidExpectations.
la = a.getLocation() and
pragma[only_bind_into](lb) = b.getLocation() and
locations_default(pragma[only_bind_into](la), f, line, _, _, _) and
locations_default(lb, f, line, _, _, _)
pragma[only_bind_into](la).hasLocationInfo(fname, line, _, _, _) and
lb.hasLocationInfo(fname, line, _, _, _)
)
}