Skip to content

[IDE] Better handle macro trailing closures #81673

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hamishknight
Copy link
Contributor

  • Allow placeholder expansion to turn macro closure arguments into trailing closures
  • Allow placeholder expansion to work for CustomAttr arguments
  • Introduce a separate trailing closure completion for trivial trailing closure cases, matching the function declaration logic.

rdar://150550747

Allow macro argument placeholders to expand into trailing closures.

rdar://150550747
Introduce a new ASTWalker option for walking CustomAttrs and use it
for the placeholder scanner to ensure we can expand placeholders in
attribute arguments.
Follow the same logic as function decl completion and suggest a
trailing closure for trivial cases.

rdar://150550747
@hamishknight
Copy link
Contributor Author

@swift-ci please test

if (!VD->hasParameterList())
return false;

auto *funcType = type->castTo<AnyFunctionType>();
Copy link
Member

Choose a reason for hiding this comment

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

Does anything guarantee that MacroDecl->getInterfaceType() is always AnyFunctionType here?

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