@@ -330,6 +330,19 @@ abstract private class Expectation extends FailureLocatable {
330330 override Location getLocation ( ) { result = comment .getLocation ( ) }
331331}
332332
333+ private predicate onSameLine ( ValidExpectation a , ActualResult b ) {
334+ exists ( File f , int line , Location la , Location lb |
335+ // Join order intent:
336+ // Take the locations of ActualResults,
337+ // join with locations in the same file / on the same line,
338+ // then match those against ValidExpectations.
339+ la = a .getLocation ( ) and
340+ pragma [ only_bind_into ] ( lb ) = b .getLocation ( ) and
341+ locations_default ( pragma [ only_bind_into ] ( la ) , f , line , _, _, _) and
342+ locations_default ( lb , f , line , _, _, _)
343+ )
344+ }
345+
333346private class ValidExpectation extends Expectation , TValidExpectation {
334347 string tag ;
335348 string value ;
@@ -344,8 +357,7 @@ private class ValidExpectation extends Expectation, TValidExpectation {
344357 string getKnownFailure ( ) { result = knownFailure }
345358
346359 predicate matchesActualResult ( ActualResult actualResult ) {
347- getLocation ( ) .getStartLine ( ) = actualResult .getLocation ( ) .getStartLine ( ) and
348- getLocation ( ) .getFile ( ) = actualResult .getLocation ( ) .getFile ( ) and
360+ onSameLine ( pragma [ only_bind_into ] ( this ) , actualResult ) and
349361 getTag ( ) = actualResult .getTag ( ) and
350362 getValue ( ) = actualResult .getValue ( )
351363 }
0 commit comments