Skip to content

Commit f68647a

Browse files
authored
Merge pull request swiftlang#63693 from DougGregor/trim-attr-name
Trim the attribute name when grabbing it from a syntax tree
2 parents 959e5bb + 9950ea0 commit f68647a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/ASTGen/Sources/ASTGen/Macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func expandAttachedMacro(
354354
discriminator: discriminator
355355
)
356356

357-
let macroName = customAttrNode.attributeName.description
357+
let macroName = customAttrNode.attributeName.trimmedDescription
358358
var evaluatedSyntaxStr: String
359359
do {
360360
switch (macro, macroRole) {

test/Macros/macro_expand_throwing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
func testThrownError() {
1616
let name = "hello"
17-
#myWarning(name) // expected-error{{#myWarning macro requires a string literal (from macro 'myWarning')}}
17+
#myWarning (name) // expected-error{{#myWarning macro requires a string literal (from macro 'myWarning')}}
1818

1919
#myWarning("experimental features ahead") // expected-warning{{experimental features ahead}}
2020
}

0 commit comments

Comments
 (0)