This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix incorrect operator< impl for HighlightingToken
ClosedPublic

Authored by nridge on Apr 10 2022, 7:01 PM.

Diff Detail

Event Timeline

nridge created this revision.Apr 10 2022, 7:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2022, 7:01 PM
nridge requested review of this revision.Apr 10 2022, 7:01 PM
nridge added a comment.EditedApr 10 2022, 7:03 PM

Not sure how to write a test for this, short of writing unit tests for the operator< itself. The consequence of this bug is that the sort/unique pass on the highlighting tokens is buggy, but as of https://github.com/clangd/clangd/issues/1057 resolveConflict() fixes up that kind of bugginess.

In any case, it's an obvious fix.

kadircet accepted this revision.Apr 11 2022, 2:38 AM

Oopsy :/ Thanks for the fix!

Regarding the test, if you came looking for this piece due to a particular issue, it might be nice to have that included in the test suite (assuming it can be minimized).
If not, I think it would still be valuable to include a simple unittest that just tests operator< by creating HighlightingTokens to make sure we don't make similar mistakes in the future.

This revision is now accepted and ready to land.Apr 11 2022, 2:38 AM
nridge updated this revision to Diff 422410.Apr 13 2022, 12:18 AM

Add semantic highlighting testcase

This revision was landed with ongoing or failed builds.Apr 13 2022, 12:20 AM
This revision was automatically updated to reflect the committed changes.