Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc: fix source code info location for missing label #6436

Conversation

jhump
Copy link
Contributor

@jhump jhump commented Jul 24, 2019

Fixes #6378.

This was always emitting a location for the label, even if no label was present. This resulted in a malformed span -- since the label did not actually exist, the associated span had an end that was before the start.

This patch makes it so that the location is simply omitted if there is no location in source (e.g. optional fields in a file with proto3 syntax).

@@ -2808,6 +2808,34 @@ TEST_F(SourceInfoTest, Fields) {
EXPECT_TRUE(HasSpan(file_.message_type(0), "name"));
}

TEST_F(SourceInfoTest, Fields) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test is failing because this test case has the same name as the previous case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I was having problems getting make check to run locally. I just got it running locally and verified that the test passes. (I also intentionally commented out a line below, hoping it would make the test fail, to ensure that these assertions would catch any location for the label that should not be present.)

Anyhow, it should be good now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, where did you see test output with that error? The only things I see in GitHub are the CLA check and a "mergeable" check which was looking at PR labels that I can't set. Or did a third check appear on a prior commit which will eventually show up for the last commit I pushed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test results must have disappeared after you pushed a new commit (since they would be invalidated in that case). I just added the tag to kick off a new test run though, so the results should start reappearing.

@acozzette acozzette self-assigned this Jul 24, 2019
@jhump jhump force-pushed the jh/fix-source-code-info-location-for-missing-label branch from 036a8bb to 76f81ce Compare July 24, 2019 18:30
@acozzette
Copy link
Member

@jhump Thanks for fixing this!

@acozzette acozzette merged commit cb58738 into protocolbuffers:master Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

protoc: invalid span in source location
4 participants