Skip to content

[6.2][AST] ASTPrinter: Improvements to specifier and attribute printing #80892

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Apr 17, 2025

Cherry-pick of #80843


  • Explanation:

    Fixes positioning of nonisolated(nonsending) and other specifiers when printed in swift interfaces. Makes sure that specifiers are always printed before attributes (how parser expects the order to be) and that attributes are printed as attributes.

    • Make sure that specifiers are always printed before attributes
    • Don't print @escaping if parameter is inout
    • Always print nonisolated(nonsending) as a first specifier
    • Make sure that attributes are consistently printed as attributes and specifiers as keywords
  • Main Branch PR: [AST] ASTPrinter: Improvements to specifier and attribute printing #80843

  • Risk: Low (The change to nonsisolated(nonsending) printing has to source compatibility impact because no existing swift interfaces have that attribute printed yet. When it comes to the rest - mixing of specifiers and attribute would have caused failures already and there could be no existing interface files that could regress due to this change).

  • Reviewed By: @xymus @ktoso

  • Testing: Added new tests to the test suite.

xedin added 5 commits April 17, 2025 11:44
When `nonisolated(nonsending)` parameter specifier is present
mark the declaration as caller isolated.

(cherry picked from commit 9bc96d4)
…ecifier first

This avoids any possible positioning issues between specifiers
and attributes.

(cherry picked from commit 6662a48)
All of the `inout` types are implicitly `@escaping`.

(cherry picked from commit ee38182)
… and specifiers as keywords

(cherry picked from commit e302d73)
@xedin xedin requested a review from a team as a code owner April 17, 2025 18:53
@xedin xedin requested a review from hborla April 17, 2025 18:53
@xedin
Copy link
Contributor Author

xedin commented Apr 17, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Apr 18, 2025

@swift-ci please test macOS platform

@xedin xedin merged commit c18e231 into swiftlang:release/6.2 Apr 18, 2025
5 checks passed
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.

3 participants