Skip to content

Commit cab9b6f

Browse files
committed
Merge pull request swiftlang#1820 from kimdv/kimdv/1815-anytype-in-header-always-outputs-as-any-type-with-an-extra-space
Remove spacing between `Any` and `.`
1 parent c89ea14 commit cab9b6f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Sources/SwiftBasicFormat/BasicFormat.swift

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

Tests/SwiftSyntaxBuilderTest/VariableTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,4 +349,17 @@ final class VariableTests: XCTestCase {
349349
assertBuildResult(builder, expected, line: line)
350350
}
351351
}
352+
353+
// https://github.com/apple/swift-syntax/issues/1815
354+
func testSpacingInDictionaryType() throws {
355+
let buildable = try VariableDeclSyntax("static var mirror: Dictionary<String, Any.Type>") {}
356+
357+
assertBuildResult(
358+
buildable,
359+
"""
360+
static var mirror: Dictionary<String, Any.Type> {
361+
}
362+
"""
363+
)
364+
}
352365
}

0 commit comments

Comments
 (0)