Fix docComments rule for macros

This commit is contained in:
Nick Lockwood
2023-10-14 08:50:16 +01:00
parent 0214767055
commit 69fdbd9707
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -2491,7 +2491,7 @@ extension Token {
"import", "let", "var", "typealias", "func", "enum", "case",
"struct", "class", "actor", "protocol", "init", "deinit",
"extension", "subscript", "operator", "precedencegroup",
"associatedtype",
"associatedtype", "macro",
])
for keywordToExclude in keywordsToExclude {
+11
View File
@@ -3322,6 +3322,17 @@ class SyntaxTests: RulesTests {
testFormatting(for: input, rule: FormatRules.docComments)
}
func testDocCommentForMacro() {
let input = """
/// Adds a static `logger` member to the type.
@attached(member, names: named(logger)) public macro StaticLogger(
subsystem: String? = nil,
category: String? = nil
) = #externalMacro(module: "StaticLoggerMacros", type: "StaticLogger")
"""
testFormatting(for: input, rule: FormatRules.docComments)
}
// MARK: - conditionalAssignment
func testDoesntConvertIfStatementAssignmentSwift5_8() {