Skip to content
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

Fix typos and update text for member attributes #69

Open
wants to merge 1 commit into
base: attached-macros
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions proposals/nnnn-attached-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The actual implementation of this macro involves a bit of syntax manipulation, s
public struct AddCompletionHandler: PeerDeclarationMacro {
public static func expansion(
of node: CustomAttributeSyntax,
peersOf declaration: DeclSyntax,
providingPeersOf declaration: DeclSyntax,
in context: inout MacroExpansionContext
) throws -> [DeclSyntax] {
// make sure we have an async function to start with
Expand Down Expand Up @@ -227,7 +227,7 @@ protocol AccessorMacro: AttachedMacro {
/// the attribute is attached.
static func expansion(
of node: AttributeSyntax,
accessorsOf declaration: DeclSyntax,
providingAccessorsOf declaration: DeclSyntax,
in context: inout MacroExpansionContext
) throws -> [AccessorDeclSyntax]
}
Expand Down Expand Up @@ -293,7 +293,7 @@ protocol MemberAttributeMacro: AttachedMacro {
}
```

The `expansion` operation accepts the attribute syntax `node` for the spelling of the member attribute macro and the declaration to which that attribute is attached (i.e., the type or extension). The implementation of the macro can walk the members of the `declaration` to determine which members require additional attributes. The returned dictionary will map from those members to the additional attributes that should be added to each of the members.
The `expansion` operation accepts the attribute syntax `node` for the spelling of the member attribute macro and the declaration to which that attribute is attached (i.e., the type or extension). The method is called for each `member` and can return additional attributes that should be added to it.

## Detailed design

Expand Down Expand Up @@ -446,7 +446,7 @@ The proposal for freestanding macros introduced the need to [specify macro-intro
* Declarations whose name is formed by adding a prefix to the name of the declaration to which the macro is attached: `prefixed("_")`
* Declarations whose name is formed by adding a suffix to the name of the declaration to which the macro is attached: `suffixed("_docinfo")`.

A macro can only introduce new declarations whose names are covered by the kinds provided, or have their names generated via `MacroExpansionContext.createUniqueame`. This ensures that, in most cases (where `arbitrary` is not specified), the Swift compiler and related tools can reason about the set of names that will introduced by a given use of a macro without having to expand the macro, which can reduce the compile-time cost of macros and improve incremental builds.
A macro can only introduce new declarations whose names are covered by the kinds provided, or have their names generated via `MacroExpansionContext.createUniqueName`. This ensures that, in most cases (where `arbitrary` is not specified), the Swift compiler and related tools can reason about the set of names that will introduced by a given use of a macro without having to expand the macro, which can reduce the compile-time cost of macros and improve incremental builds.

### Ordering of macro expansions

Expand Down