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

fix getFile() for serialization #1847

Merged
merged 3 commits into from
Feb 14, 2018
Merged

Conversation

Egor18
Copy link
Contributor

@Egor18 Egor18 commented Feb 13, 2018

Hi! I found out that filename from SourcePosition is lost during serialization (it's null). Although line number, column, etc. are present in deserialized model.
This happens because getFile() uses compilationUnit, which is null in deserialized model.
I fixed that by introducing field 'file' in SourcePosition.
Also, I provided some tests. Particularly, without this fix the following assertions fail:

assertTrue(type.getPosition().getFile().equals(typeFromFile.getPosition().getFile()));
....
assertTrue(elem1.getPosition().getFile().equals(elem2.getPosition().getFile()));

Really want this fix, because without it we can't get any filename from SourcePosition from deserialized model.

@monperrus
Copy link
Collaborator

OK for me.

@pvojtechovsky
Copy link
Collaborator

OK for me too

@surli
Copy link
Collaborator

surli commented Feb 14, 2018

Hi @Egor18 thanks for the fix! Could you just add a contract in comment of the test, then I'll merge the PR?

@surli surli merged commit 8fa3175 into INRIA:master Feb 14, 2018
@Egor18
Copy link
Contributor Author

Egor18 commented Feb 14, 2018

Thanks!

@Egor18 Egor18 deleted the fix_position_serialization branch February 15, 2018 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants