Skip to content

Commit a73fea1

Browse files
committed
Remove spacing between Any and .
1 parent 49b3bbd commit a73fea1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Sources/SwiftBasicFormat/BasicFormat.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ open class BasicFormat: SyntaxRewriter {
206206
(.identifier, .leftSquare), // myArray[1]
207207
(.identifier, .period), // a.b
208208
(.integerLiteral, .period), // macOS 11.2.1
209+
(.keyword(.Any), .period), // Any.Type
209210
(.keyword(.`init`), .leftAngle), // init<T>()
210211
(.keyword(.`init`), .leftParen), // init()
211212
(.keyword(.self), .period), // self.someProperty

Tests/SwiftSyntaxBuilderTest/VariableTests.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,4 +371,20 @@ final class VariableTests: XCTestCase {
371371
assertBuildResult(builder, expected, line: line)
372372
}
373373
}
374+
375+
// https://github.com/apple/swift-syntax/issues/1815
376+
func testSpacingInDictionaryType() throws {
377+
let header = PartialSyntaxNodeString(stringLiteral: "static var mirror: Dictionary<String, Any.Type>")
378+
let buildable = try VariableDeclSyntax(header) {
379+
380+
}
381+
382+
assertBuildResult(
383+
buildable,
384+
"""
385+
static var mirror: Dictionary<String, Any.Type> {
386+
}
387+
"""
388+
)
389+
}
374390
}

0 commit comments

Comments
 (0)