Update SwiftSyntax (#4852)
This commit is contained in:
parent
82491e6f84
commit
58a07eb452
|
@ -32,8 +32,8 @@
|
|||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-syntax.git",
|
||||
"state" : {
|
||||
"revision" : "013a48e2312e57b7b355db25bd3ea75282ebf274",
|
||||
"version" : "0.50900.0-swift-DEVELOPMENT-SNAPSHOT-2023-02-06-a"
|
||||
"revision" : "07c08da983b2815a0acc8e3a477573e4c663b158",
|
||||
"version" : "509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-03-17-a"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ let package = Package(
|
|||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.2.1")),
|
||||
.package(url: "https://github.com/apple/swift-syntax.git", exact: "0.50900.0-swift-DEVELOPMENT-SNAPSHOT-2023-02-06-a"),
|
||||
.package(url: "https://github.com/apple/swift-syntax.git", exact: "509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-03-17-a"),
|
||||
.package(url: "https://github.com/jpsim/SourceKitten.git", .upToNextMinor(from: "0.34.1")),
|
||||
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.5"),
|
||||
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"),
|
||||
|
|
|
@ -83,7 +83,7 @@ private extension ExplicitTopLevelACLRule {
|
|||
|
||||
override func visitPost(_ node: VariableDeclSyntax) {
|
||||
if hasViolation(modifiers: node.modifiers) {
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ extension LegacyHashingRule {
|
|||
override func visitPost(_ node: VariableDeclSyntax) {
|
||||
guard
|
||||
node.parent?.is(MemberDeclListItemSyntax.self) == true,
|
||||
node.letOrVarKeyword.tokenKind == .keyword(.var),
|
||||
node.bindingKeyword.tokenKind == .keyword(.var),
|
||||
let binding = node.bindings.onlyElement,
|
||||
let identifier = binding.pattern.as(IdentifierPatternSyntax.self),
|
||||
identifier.identifier.text == "hashValue",
|
||||
|
@ -95,7 +95,7 @@ extension LegacyHashingRule {
|
|||
return
|
||||
}
|
||||
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,12 +57,12 @@ private extension PatternMatchingKeywordsRule {
|
|||
}
|
||||
|
||||
guard list.count > 1,
|
||||
let firstLetOrVar = list.first?.letOrVarKeyword.tokenKind else {
|
||||
let firstLetOrVar = list.first?.bindingKeyword.tokenKind else {
|
||||
return
|
||||
}
|
||||
|
||||
let hasViolation = list.allSatisfy { elem in
|
||||
elem.letOrVarKeyword.tokenKind == firstLetOrVar
|
||||
elem.bindingKeyword.tokenKind == firstLetOrVar
|
||||
}
|
||||
|
||||
guard hasViolation else {
|
||||
|
@ -70,7 +70,7 @@ private extension PatternMatchingKeywordsRule {
|
|||
}
|
||||
|
||||
violations.append(contentsOf: list.compactMap { elem in
|
||||
return elem.letOrVarKeyword.positionAfterSkippingLeadingTrivia
|
||||
return elem.bindingKeyword.positionAfterSkippingLeadingTrivia
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ struct RedundantOptionalInitializationRule: SwiftSyntaxCorrectableRule, Configur
|
|||
private extension RedundantOptionalInitializationRule {
|
||||
final class Visitor: ViolationsSyntaxVisitor {
|
||||
override func visitPost(_ node: VariableDeclSyntax) {
|
||||
guard node.letOrVarKeyword.tokenKind == .keyword(.var),
|
||||
guard node.bindingKeyword.tokenKind == .keyword(.var),
|
||||
!node.modifiers.containsLazy else {
|
||||
return
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ private extension RedundantOptionalInitializationRule {
|
|||
}
|
||||
|
||||
override func visit(_ node: VariableDeclSyntax) -> DeclSyntax {
|
||||
guard node.letOrVarKeyword.tokenKind == .keyword(.var),
|
||||
guard node.bindingKeyword.tokenKind == .keyword(.var),
|
||||
!node.modifiers.containsLazy else {
|
||||
return super.visit(node)
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ struct ShorthandOptionalBindingRule: OptInRule, SwiftSyntaxCorrectableRule, Conf
|
|||
private class Visitor: ViolationsSyntaxVisitor {
|
||||
override func visitPost(_ node: OptionalBindingConditionSyntax) {
|
||||
if node.isShadowingOptionalBinding {
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ private extension OverrideInExtensionRule {
|
|||
|
||||
override func visitPost(_ node: VariableDeclSyntax) {
|
||||
if node.modifiers.containsOverride {
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword .positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ private extension PrivateOutletRule {
|
|||
return
|
||||
}
|
||||
|
||||
violations.append(decl.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(decl.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ private extension ProhibitedInterfaceBuilderRule {
|
|||
final class Visitor: ViolationsSyntaxVisitor {
|
||||
override func visitPost(_ node: VariableDeclSyntax) {
|
||||
if node.isIBOutlet {
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ private extension SelfInPropertyInitializationRule {
|
|||
continue
|
||||
}
|
||||
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ private extension TestCaseAccessibilityRule {
|
|||
continue
|
||||
}
|
||||
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ private extension ValidIBInspectableRule {
|
|||
|
||||
override func visitPost(_ node: VariableDeclSyntax) {
|
||||
if node.isInstanceVariable, node.isIBInspectable, node.hasViolation {
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ private extension VariableDeclSyntax {
|
|||
}
|
||||
|
||||
var isReadOnlyProperty: Bool {
|
||||
if letOrVarKeyword.tokenKind == .keyword(.let) {
|
||||
if bindingKeyword.tokenKind == .keyword(.let) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ private extension WeakDelegateRule {
|
|||
return
|
||||
}
|
||||
|
||||
violations.append(node.letOrVarKeyword.positionAfterSkippingLeadingTrivia)
|
||||
violations.append(node.bindingKeyword.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ private extension AttributeListSyntax {
|
|||
} else if let importTok = parent.as(ImportDeclSyntax.self)?.importTok {
|
||||
keyword = importTok
|
||||
shouldBeOnSameLine = true
|
||||
} else if let letOrVarKeyword = parent.as(VariableDeclSyntax.self)?.letOrVarKeyword {
|
||||
} else if let letOrVarKeyword = parent.as(VariableDeclSyntax.self)?.bindingKeyword {
|
||||
keyword = letOrVarKeyword
|
||||
shouldBeOnSameLine = true
|
||||
} else {
|
||||
|
|
|
@ -87,7 +87,7 @@ private extension PrefixedTopLevelConstantRule {
|
|||
override var skippableDeclarations: [DeclSyntaxProtocol.Type] { .all }
|
||||
|
||||
override func visitPost(_ node: VariableDeclSyntax) {
|
||||
guard node.letOrVarKeyword.tokenKind == .keyword(.let) else {
|
||||
guard node.bindingKeyword.tokenKind == .keyword(.let) else {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ private extension RedundantDiscardableLetRule {
|
|||
|
||||
correctionPositions.append(node.positionAfterSkippingLeadingTrivia)
|
||||
let newNode = node
|
||||
.with(\.letOrVarKeyword, .keyword(.let, presence: .missing))
|
||||
.with(\.bindings, node.bindings.with(\.leadingTrivia, node.letOrVarKeyword.leadingTrivia))
|
||||
.with(\.bindingKeyword, .keyword(.let, presence: .missing))
|
||||
.with(\.bindings, node.bindings.with(\.leadingTrivia, node.bindingKeyword.leadingTrivia))
|
||||
return super.visit(newNode)
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ private extension RedundantDiscardableLetRule {
|
|||
|
||||
private extension VariableDeclSyntax {
|
||||
var hasRedundantDiscardableLetViolation: Bool {
|
||||
letOrVarKeyword.tokenKind == .keyword(.let) &&
|
||||
bindingKeyword.tokenKind == .keyword(.let) &&
|
||||
bindings.count == 1 &&
|
||||
bindings.first!.pattern.is(WildcardPatternSyntax.self) &&
|
||||
bindings.first!.typeAnnotation == nil &&
|
||||
|
|
|
@ -20,10 +20,10 @@ def swiftlint_repos(bzlmod = False):
|
|||
|
||||
http_archive(
|
||||
name = "com_github_apple_swift_syntax",
|
||||
sha256 = "ef9701634ad34e2dd08a2cd85bb5437af17512175bf6b4623c7d2d28068b6786", # SwiftSyntax sha256
|
||||
sha256 = "0698b10d5784bc91fc60cd740f8c16dbe7debcea67759fdf293bb1c8bdb6eedc", # SwiftSyntax sha256
|
||||
build_file = "@SwiftLint//bazel:SwiftSyntax.BUILD",
|
||||
strip_prefix = "swift-syntax-0.50900.0-swift-DEVELOPMENT-SNAPSHOT-2023-02-06-a",
|
||||
url = "https://github.com/apple/swift-syntax/archive/refs/tags/0.50900.0-swift-DEVELOPMENT-SNAPSHOT-2023-02-06-a.tar.gz",
|
||||
strip_prefix = "swift-syntax-509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-03-17-a",
|
||||
url = "https://github.com/apple/swift-syntax/archive/refs/tags/509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-03-17-a.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
|
|
Loading…
Reference in New Issue