Update SwiftSyntax to `fa7ff05` (#4455)
There's a new SwiftParserDiagnostics module and the rewriter visit function signatures changed.
This commit is contained in:
parent
401d0f7929
commit
1ee5154687
|
@ -33,7 +33,7 @@
|
|||
"repositoryURL": "https://github.com/apple/swift-syntax.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "60c7037405b3e0ecc4d42805bc46dbcbb947afc0",
|
||||
"revision": "fa7ff05591294db031e3061e704994aa3b89d1bc",
|
||||
"version": null
|
||||
}
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ let package = Package(
|
|||
],
|
||||
dependencies: [
|
||||
.package(name: "swift-argument-parser", url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.1.3")),
|
||||
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .revision("60c7037405b3e0ecc4d42805bc46dbcbb947afc0")),
|
||||
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .revision("fa7ff05591294db031e3061e704994aa3b89d1bc")),
|
||||
.package(url: "https://github.com/jpsim/SourceKitten.git", .revision("a9e6df65d8e31e0fa6e8a05ffe40ecd54a645871")),
|
||||
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.1"),
|
||||
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"),
|
||||
|
|
|
@ -4,6 +4,7 @@ import Darwin
|
|||
import Foundation
|
||||
import SourceKittenFramework
|
||||
import SwiftParser
|
||||
import SwiftParserDiagnostics
|
||||
import SwiftSyntax
|
||||
|
||||
private typealias FileCacheKey = UUID
|
||||
|
|
|
@ -54,7 +54,7 @@ private extension RedundantNilCoalescingRule {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: ExprListSyntax) -> Syntax {
|
||||
override func visit(_ node: ExprListSyntax) -> ExprListSyntax {
|
||||
guard
|
||||
node.count > 2,
|
||||
let lastExpression = node.last,
|
||||
|
|
|
@ -111,7 +111,7 @@ private class Rewriter: SyntaxRewriter, ViolationsSyntaxRewriter {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: OptionalBindingConditionSyntax) -> Syntax {
|
||||
override func visit(_ node: OptionalBindingConditionSyntax) -> OptionalBindingConditionSyntax {
|
||||
guard
|
||||
node.isShadowingOptionalBinding,
|
||||
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
|
||||
|
|
|
@ -62,7 +62,7 @@ private extension ToggleBoolRule {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: ExprListSyntax) -> Syntax {
|
||||
override func visit(_ node: ExprListSyntax) -> ExprListSyntax {
|
||||
guard
|
||||
node.hasToggleBoolViolation,
|
||||
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
|
||||
|
|
|
@ -144,7 +144,7 @@ private final class UntypedErrorInCatchRuleRewriter: SyntaxRewriter, ViolationsS
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: CatchClauseSyntax) -> Syntax {
|
||||
override func visit(_ node: CatchClauseSyntax) -> CatchClauseSyntax {
|
||||
guard
|
||||
node.catchItems?.count == 1,
|
||||
let item = node.catchItems?.first,
|
||||
|
|
|
@ -72,7 +72,7 @@ private extension AnyObjectProtocolRule {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: InheritedTypeSyntax) -> Syntax {
|
||||
override func visit(_ node: InheritedTypeSyntax) -> InheritedTypeSyntax {
|
||||
let typeName = node.typeName
|
||||
guard
|
||||
typeName.is(ClassRestrictionTypeSyntax.self),
|
||||
|
|
|
@ -87,7 +87,7 @@ private extension LowerACLThanParentRule {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: DeclModifierSyntax) -> Syntax {
|
||||
override func visit(_ node: DeclModifierSyntax) -> DeclModifierSyntax {
|
||||
guard
|
||||
node.isHigherACLThanParent,
|
||||
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
|
||||
|
|
|
@ -82,7 +82,7 @@ private final class ClosureSpacingRuleRewriter: SyntaxRewriter, ViolationsSyntax
|
|||
|
||||
override func visit(_ node: ClosureExprSyntax) -> ExprSyntax {
|
||||
var node = node
|
||||
node.statements = visit(node.statements).as(CodeBlockItemListSyntax.self)!
|
||||
node.statements = visit(node.statements)
|
||||
|
||||
guard
|
||||
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter),
|
||||
|
|
|
@ -144,7 +144,7 @@ private extension EmptyEnumArgumentsRule {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: CaseItemSyntax) -> Syntax {
|
||||
override func visit(_ node: CaseItemSyntax) -> CaseItemSyntax {
|
||||
guard
|
||||
let (violationPosition, newPattern) = node.pattern.emptyEnumArgumentsViolation(rewrite: true),
|
||||
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
|
||||
|
@ -153,10 +153,10 @@ private extension EmptyEnumArgumentsRule {
|
|||
}
|
||||
|
||||
correctionPositions.append(violationPosition)
|
||||
return super.visit(Syntax(node.withPattern(newPattern)))
|
||||
return super.visit(node.withPattern(newPattern))
|
||||
}
|
||||
|
||||
override func visit(_ node: MatchingPatternConditionSyntax) -> Syntax {
|
||||
override func visit(_ node: MatchingPatternConditionSyntax) -> MatchingPatternConditionSyntax {
|
||||
guard
|
||||
let (violationPosition, newPattern) = node.pattern.emptyEnumArgumentsViolation(rewrite: true),
|
||||
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
|
||||
|
@ -165,7 +165,7 @@ private extension EmptyEnumArgumentsRule {
|
|||
}
|
||||
|
||||
correctionPositions.append(violationPosition)
|
||||
return super.visit(Syntax(node.withPattern(newPattern)))
|
||||
return super.visit(node.withPattern(newPattern))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ private extension ProtocolPropertyAccessorsOrderRule {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: AccessorBlockSyntax) -> Syntax {
|
||||
override func visit(_ node: AccessorBlockSyntax) -> AccessorBlockSyntax {
|
||||
guard
|
||||
node.hasViolation,
|
||||
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
|
||||
|
|
|
@ -94,7 +94,7 @@ private final class SelfBindingRuleRewriter: SyntaxRewriter, ViolationsSyntaxRew
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: OptionalBindingConditionSyntax) -> Syntax {
|
||||
override func visit(_ node: OptionalBindingConditionSyntax) -> OptionalBindingConditionSyntax {
|
||||
guard
|
||||
let identifierPattern = node.pattern.as(IdentifierPatternSyntax.self),
|
||||
identifierPattern.identifier.text != bindIdentifier,
|
||||
|
|
|
@ -126,7 +126,7 @@ private extension TrailingCommaRule {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: DictionaryElementListSyntax) -> Syntax {
|
||||
override func visit(_ node: DictionaryElementListSyntax) -> DictionaryElementListSyntax {
|
||||
guard let lastElement = node.last,
|
||||
!lastElement.isContainedIn(regions: disabledRegions, locationConverter: locationConverter) else {
|
||||
return super.visit(node)
|
||||
|
@ -163,7 +163,7 @@ private extension TrailingCommaRule {
|
|||
}
|
||||
}
|
||||
|
||||
override func visit(_ node: ArrayElementListSyntax) -> Syntax {
|
||||
override func visit(_ node: ArrayElementListSyntax) -> ArrayElementListSyntax {
|
||||
guard let lastElement = node.last,
|
||||
!lastElement.isContainedIn(regions: disabledRegions, locationConverter: locationConverter) else {
|
||||
return super.visit(node)
|
||||
|
|
|
@ -109,7 +109,7 @@ private final class Rewriter: SyntaxRewriter, ViolationsSyntaxRewriter {
|
|||
self.disabledRegions = disabledRegions
|
||||
}
|
||||
|
||||
override func visit(_ node: ClosureSignatureSyntax) -> Syntax {
|
||||
override func visit(_ node: ClosureSignatureSyntax) -> ClosureSignatureSyntax {
|
||||
guard
|
||||
let clause = node.input?.as(ParameterClauseSyntax.self),
|
||||
!clause.parameterList.contains(where: { $0.type != nil }),
|
||||
|
|
|
@ -48,6 +48,7 @@ swift_library(
|
|||
deps = [
|
||||
":SwiftBasicFormat",
|
||||
":SwiftParser",
|
||||
":SwiftParserDiagnostics",
|
||||
":SwiftSyntax",
|
||||
],
|
||||
)
|
||||
|
@ -63,12 +64,25 @@ swift_library(
|
|||
],
|
||||
)
|
||||
|
||||
swift_library(
|
||||
name = "SwiftParserDiagnostics",
|
||||
srcs = glob(["Sources/SwiftParserDiagnostics/**/*.swift"]),
|
||||
module_name = "SwiftParserDiagnostics",
|
||||
deps = [
|
||||
":SwiftBasicFormat",
|
||||
":SwiftDiagnostics",
|
||||
":SwiftParser",
|
||||
":SwiftSyntax",
|
||||
],
|
||||
)
|
||||
|
||||
opt_wrapper(
|
||||
name = "optlibs",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":SwiftOperators",
|
||||
":SwiftParser",
|
||||
":SwiftParserDiagnostics",
|
||||
":SwiftSyntax",
|
||||
":SwiftSyntaxBuilder",
|
||||
],
|
||||
|
|
|
@ -20,10 +20,10 @@ def swiftlint_repos():
|
|||
|
||||
http_archive(
|
||||
name = "com_github_apple_swift_syntax",
|
||||
sha256 = "a4b0527ff3d0f4d002c85b246fde52552d2cfbbfa2329a298a2ee44aa66ded9a",
|
||||
sha256 = "6962cd269321a23a2e4b3738a870afe30b2c99dfb48f53b9898bdab4e2a8d4d7",
|
||||
build_file = "@SwiftLint//bazel:SwiftSyntax.BUILD",
|
||||
strip_prefix = "swift-syntax-60c7037405b3e0ecc4d42805bc46dbcbb947afc0",
|
||||
url = "https://github.com/apple/swift-syntax/archive/60c7037405b3e0ecc4d42805bc46dbcbb947afc0.tar.gz",
|
||||
strip_prefix = "swift-syntax-fa7ff05591294db031e3061e704994aa3b89d1bc",
|
||||
url = "https://github.com/apple/swift-syntax/archive/fa7ff05591294db031e3061e704994aa3b89d1bc.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
|
|
Loading…
Reference in New Issue