Skip to content

Commit

Permalink
Fix a bug in SourceInformation.isValid (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-m-knight-gs committed May 14, 2024
1 parent 892706c commit f7e8fbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ public boolean isValid()
return (this.sourceId != null) &&
(this.startLine >= 1) &&
(this.startColumn >= 1) &&
(this.column >= 1) &&
(this.endColumn >= 1) &&
isNotBefore(this.line, this.column, this.startLine, this.startColumn) &&
isNotBefore(this.endLine, this.endColumn, this.line, this.column);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ public void testIsValid()
Assert.assertFalse(new SourceInformation(sourceId, 5, 1, 5, 3, 5, 2).isValid());
Assert.assertFalse(new SourceInformation(sourceId, 5, 3, 5, 2, 5, 8).isValid());
Assert.assertFalse(new SourceInformation(sourceId, 5, 3, 5, 5, 4, 8).isValid());

Assert.assertTrue(new SourceInformation(sourceId, 5, 3, 6, 1, 7, 8).isValid());
Assert.assertFalse(new SourceInformation(sourceId, 5, 3, 6, 0, 7, 8).isValid());
Assert.assertFalse(new SourceInformation(sourceId, 5, 3, 6, 1, 7, 0).isValid());
}

private void assertSubsumes(SourceInformation sourceInfo1, SourceInformation sourceInfo2)
Expand Down

0 comments on commit f7e8fbc

Please sign in to comment.