Skip to content

Commit 714f91f

Browse files
authored
Merge pull request swiftlang#238 from dabelknap/linux
Changes needed to build/test on Linux.
2 parents 414783a + 0a3002f commit 714f91f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Sources/SwiftFormatRules/UseShorthandTypeNames.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {
3636

3737
// Ensure that all arguments in the clause are shortened and in expected-format by visiting
3838
// the argument list, first
39-
let argList = super.visit(genArg.arguments) as! GenericArgumentListSyntax
39+
let argList = visit(genArg.arguments) as! GenericArgumentListSyntax
4040
// Store trivia of the long form type to pass to the new shorthand type later
4141
let trivia = retrieveTrivia(from: node)
4242

@@ -61,10 +61,9 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {
6161

6262
// Visits all potential long forms interpreted as expressions
6363
public override func visit(_ node: SpecializeExprSyntax) -> ExprSyntax {
64-
let argList = super.visit(node.genericArgumentClause.arguments) as! GenericArgumentListSyntax
64+
let argList = visit(node.genericArgumentClause.arguments) as! GenericArgumentListSyntax
6565
guard let exp = node.expression as? IdentifierExprSyntax else { return node }
6666
let trivia = retrieveTrivia(from: node)
67-
6867
switch exp.identifier.text {
6968
case "Array":
7069
guard argList.count == 1 else { return node }
@@ -199,7 +198,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {
199198
guard let simpleTypeId = member.baseType as? SimpleTypeIdentifierSyntax else { return nil }
200199
guard let genArgClause = simpleTypeId.genericArgumentClause else { return nil }
201200
// Node will only change if an argument in the generic argument clause is shortened
202-
let argClause = super.visit(genArgClause) as! GenericArgumentClauseSyntax
201+
let argClause = visit(genArgClause) as! GenericArgumentClauseSyntax
203202
let idExp = SyntaxFactory.makeIdentifierExpr(identifier: simpleTypeId.name,
204203
declNameArguments: nil)
205204
let specialExp = SyntaxFactory.makeSpecializeExpr(expression: idExp,

Tests/SwiftFormatRulesTests/BeginDocumentationCommentWithOneLineSummaryTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public class BeginDocumentationCommentWithOneLineSummaryTests: DiagnosingTestCas
101101
"This block comment contains a sentence summary of two lines of code."))
102102
}
103103

104-
#if os(macOS)
105104
public func testApproximationsOnMacOS() {
105+
#if os(macOS)
106106
// Let macOS also verify that the fallback mode works, which gives us signal about whether it
107107
// will also succeed on Linux (where the linguistic APIs are not currently available).
108108
BeginDocumentationCommentWithOneLineSummary.forcesFallbackModeForTesting = true
@@ -148,6 +148,6 @@ public class BeginDocumentationCommentWithOneLineSummaryTests: DiagnosingTestCas
148148
"Contains a comment as description that needs a sentece of two lines of code."))
149149
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence("The background color of the view."))
150150
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence("Returns the sum of the numbers."))
151+
#endif
151152
}
152-
#endif
153153
}

0 commit comments

Comments
 (0)