Skip to content

Commit 9950ea0

Browse files
committed
Trim the attribute name when grabbing it from a syntax tree
1 parent 4705183 commit 9950ea0

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
@@ -345,7 +345,7 @@ func expandAttachedMacro(
345345
// Create an expansion context
346346
let context = sourceManager.createMacroExpansionContext()
347347

348-
let macroName = customAttrNode.attributeName.description
348+
let macroName = customAttrNode.attributeName.trimmedDescription
349349
var evaluatedSyntaxStr: String
350350
do {
351351
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)