Skip to content

Fix a string interpolation error in CodeGeneration #2159

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

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Sep 6, 2023

leafProtocolDecl placed two declarations within the same DeclSyntax, which didn’t parse correctly, triggering logStringInterpolationParsingError. Split the function so that one returns the protocol declaration and the other returns the extension.

`leafProtocolDecl` placed two declarations within the same `DeclSyntax`, which didn’t parse correctly, triggering `logStringInterpolationParsingError`. Split the function so that one returns the protocol declaration and the other returns the extension.
@ahoppen
Copy link
Member Author

ahoppen commented Sep 6, 2023

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge September 6, 2023 23:37
@ahoppen ahoppen merged commit 2444350 into swiftlang:main Sep 7, 2023
@Matejkob
Copy link
Contributor

Matejkob commented Sep 7, 2023

Hmmm, that's interesting. So if we wanna create two functions do we need two different DeclSyntax?

DeclSyntax(
"""
func foo() { }
func bar() { }
"""
)

vs.

DeclSyntax(
"""
func foo() { }
"""
)
DeclSyntax(
"""
func bar() { }
"""
)

?

@ahoppen ahoppen deleted the ahoppen/string-interpolation-fix branch September 7, 2023 17:06
@ahoppen
Copy link
Member Author

ahoppen commented Sep 7, 2023

Yes, a DeclSyntax only represents a single declaration. To represent a list of declarations, we should use CodeBlockItemListSyntax or MemberBlockItemListSyntax.

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.

2 participants