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
[SR-7061] libSyntax built from source contains nulls in simple file definition #49609
Comments
cc @nkcsgexi |
this is not a problem per se since the Json is just internal representation of the source file. We expect users to use typed Swift syntax apis that can be serialized from this format. Could you clarify what do you try to achieve? |
I guess I was expecting there to not be any nulls here. I'm currently testing out https://github.com/prettier/plugin-swift which uses libSyntax. But if it just needs to be updated to handle nulls that's fine, I was just surprised to see them added. |
I think we intentionally use "null" here to reduce the serialization size. @rintaro is that right? probably we should rename it to something else to avoid such confusion. |
I intentionally introduced Keith (JIRA User), please do not use JSON representation, |
Comment by Orta Therox (JIRA) Is there a chance you can explain what the supported way would be to get the AST syntax out? For example, do we need to build our own CLI to link with libSyntax and pull out the AST and export it in our own JSON format? Ideally we'd want a somewhat reliable source that is available with the default tools like the above example. If it changes between swift versions, that's feasible to handle with enough eyes and hands on the problem. |
@rintaro any thoughts on orta.therox@gmail.com (JIRA User)'s comment? |
orta.therox@gmail.com (JIRA User) Sorry for the late.
The current primary way is to use @nkcsgexi Any comments? |
libSyntax was removed in #62145 and succeeded by swift-syntax. |
Additional Detail from JIRA
md5: 60ecd6763a9bc9f8e4fae102fde25ade
Issue Description:
If you build Swift (as of 0ae61f6) and attempt to fetch the syntax of this file:
Using:
You end up with this result:
Note the nulls scattered throughout the output. This does seem to not have the same problem as #49608
The text was updated successfully, but these errors were encountered: