swift-syntax
swift-syntax copied to clipboard
A set of Swift libraries for parsing, inspecting, generating, and transforming Swift source code.
### Description If macro is nested in some closure, its trailing closure preserves the original code indentation. So if I build `FunctionCallExprSyntax` with trailing closure that takes statements from the...
### Description For syntax nodes like `FunctionEffectSpecifiersSyntax` and `FunctionParameterSyntax`, some spacings are required internally. However, if a handcraft node is interpolated into another expression string, `SwiftSyntaxBuilder` fails to add these...
The following new test case fails. ```swift func testClosureParameter() { let source = """ myFunc({ return true }) """ assertFormatted(source: source, expected: source) } ``` The actual formatted source is...
A very early stage of the refactoring of `SyntaxClassifier`. Refactoring `SyntaxClassifier` with `SyntaxVisitor` makes it easier to maintain. We do not pass all the tests in `ClassificationTests` yet and we...
In the following two cases, we appear to add too much indentation in front of the `return`. ```swift let source: AccessorDeclSyntax = """ get { return 1 } """ assertFormatted(...
### Description Macro expansions create diagnostics that are not relative to the given context (because they're `detached`), which means that there's no way to collocate diagnostics with the original source....
Running operator folding on MovieSwiftUI takes as long as parsing. That really shouldn’t be the case. Running with Instruments shows that we spend the majority of time in memory-related operations....
A very common task for macros is to extract the argument for a specific function parameter. Instead of having each macro dig through the `LabeledExprListSyntax`, we should offer a high-level...
We should have a single documentation document that describes all the environment variables that can be used to modify the behavior of Package.swift (e.g. `SWIFT_BUILD_SCRIPT_ENVIRONMENT`) and test execution (e.g. `SKIP_LONG_TESTS`)
The following recursive expansion of a macro causes an infinite loop in `MacroSystem`, which is used by `assertMacroExpansion`. The compiler diagnoses the circular evaluation of the macro. `MacroSystem` should do...