Skip to content

Commit d6ea1fa

Browse files
authored
Merge pull request #2259 from nsswifter/main
[SE-0415] Adjusted spacing and removed extra characters
2 parents dae33aa + f1b9da8 commit d6ea1fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

proposals/0415-function-body-macros.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ actor Chef {
255255

256256
When a function body macro is applied, the macro-expanded function body will need to be type checked when it is incorporated into the program. However, the function might already have a body that was written by the developer, which can be inspected by the macro implementation. The function body as written must be syntactically well-formed (i.e., it must conform to the [Swift grammar](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/summaryofthegrammar/)) but will *not* be type-checked, so it need not be semantically well-formed.
257257

258-
This approach follows what other attached macros do: they operate on the syntax of the declaration to which they are attached, and the declaration itself need not have been type-checked before the macro is expanded. However, this approach does lend itself to potential abuse. For example, one could create a ` SQL` macro that expects the function body to be a SQL statement, then rewrites that into code that executes the query. For example, the input could be:
258+
This approach follows what other attached macros do: they operate on the syntax of the declaration to which they are attached, and the declaration itself need not have been type-checked before the macro is expanded. However, this approach does lend itself to potential abuse. For example, one could create a `SQL` macro that expects the function body to be a SQL statement, then rewrites that into code that executes the query. For example, the input could be:
259259

260260
```swift
261261
@SQL
@@ -427,6 +427,6 @@ On the other hand, type-checking the function bodies before macro expansion has
427427
* Clarify the effect of function body macros on single-expression functions and implicit returns
428428
* Revision 1:
429429
* Allow preamble macros to introduce names.
430-
* Introduce `@AssumeMainActor `example macro for body macros that perform replacement.
430+
* Introduce `@AssumeMainActor` example macro for body macros that perform replacement.
431431
* Switch `@Traced` example over to be a preamble macro with push/pop operations, so it can nicely introduce `span`.
432432
* Allow function body macros to be applied to properties that use the shorthand getter syntax.

0 commit comments

Comments
 (0)