Skip to content

[Sema] Downgrade noasync diagnostic to warning for closure macro args#80853

Merged
hamishknight merged 3 commits into
swiftlang:mainfrom
hamishknight:macro-async-warning
Apr 18, 2025
Merged

[Sema] Downgrade noasync diagnostic to warning for closure macro args#80853
hamishknight merged 3 commits into
swiftlang:mainfrom
hamishknight:macro-async-warning

Conversation

@hamishknight

@hamishknight hamishknight commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Downgrade to a warning until the next language mode. This is necessary since we previously missed coercing macro arguments to parameter types, resulting in cases where closure arguments weren't being treated as async when they should have been. This then allows us to reapply #80583.

rdar://149328745
Resolves #80835

@hamishknight

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@hamishknight

Copy link
Copy Markdown
Contributor Author

@swift-ci please test source compatibility

Comment thread lib/Sema/TypeCheckAvailability.cpp Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was originally hoping we could use namelookup::isInMacroArgument here, but we don't currently track macro expansion expressions in the ASTScope tree and it didn't really seem worth it for this change.

Comment thread include/swift/AST/DiagnosticEngine.h Outdated
Comment thread include/swift/Basic/Version.h Outdated
Previously we would avoid rewriting the arguments in CSApply, but
that can result in incorrect behavior in MiscDiagnostics passes, e.g
incorrectly treating all closure arguments as escaping. Make sure
we rewrite the arguments as we would in regular type-checking.

rdar://148665502
Introduce `Version::getFutureMajorLanguageVersion` to make it easier
to find clients that will need to be updated once we have a new
language mode.
Downgrade to a warning until the next language mode. This is
necessary since we previously missed coercing macro arguments to
parameter types, resulting in cases where closure arguments weren't
being treated as `async` when they should have been.

rdar://149328745
@hamishknight

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

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.

Downgrade diagnostic for uses of noasync declarations in async contexts in macro arguments

3 participants