Skip to content

Commit

Permalink
Update SwiftSyntax (realm#4431)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim authored Oct 20, 2022
1 parent 469a3aa commit e84430f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"repositoryURL": "https://github.com/apple/swift-syntax.git",
"state": {
"branch": null,
"revision": "75492a3ea7498572a30beb1e3c5cfb073da8e753",
"revision": "0519e76999c9e548e58222e45a22f177c886d8c0",
"version": null
}
},
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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("75492a3ea7498572a30beb1e3c5cfb073da8e753")),
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .revision("0519e76999c9e548e58222e45a22f177c886d8c0")),
.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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ private extension DiscouragedObjectLiteralRule {
super.init(viewMode: .sourceAccurate)
}

override func visitPost(_ node: ObjectLiteralExprSyntax) {
if !configuration.imageLiteral && node.identifier.text == "#imageLiteral" {
override func visitPost(_ node: MacroExpansionExprSyntax) {
guard
case let .identifier(identifierText) = node.macro.tokenKind,
["colorLiteral", "imageLiteral"].contains(identifierText)
else {
return
}

if !configuration.colorLiteral && node.identifier.text == "#colorLiteral" {
if !configuration.imageLiteral && identifierText == "imageLiteral" {
return
}

if !configuration.colorLiteral && identifierText == "colorLiteral" {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private extension TrailingSemicolonRule {
self.disabledRegions = disabledRegions
}

override func visit(_ node: TokenSyntax) -> Syntax {
override func visit(_ node: TokenSyntax) -> TokenSyntax {
guard
node.isTrailingSemicolon,
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private extension ClosingBraceRule {
self.disabledRegions = disabledRegions
}

override func visit(_ node: TokenSyntax) -> Syntax {
override func visit(_ node: TokenSyntax) -> TokenSyntax {
guard
node.hasClosingBraceViolation,
!node.isContainedIn(regions: disabledRegions, locationConverter: locationConverter)
Expand Down
6 changes: 3 additions & 3 deletions bazel/repos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def swiftlint_repos():

http_archive(
name = "com_github_apple_swift_syntax",
sha256 = "9b4c48e04408e89cf2d2219b85afcb983f230b57d21fa206223fd29fb8202843",
sha256 = "331d411773efcd924e3e91f0f9899715c2259bedd29277693baa5263ee588220",
build_file = "@SwiftLint//bazel:SwiftSyntax.BUILD",
strip_prefix = "swift-syntax-75492a3ea7498572a30beb1e3c5cfb073da8e753",
url = "https://github.com/apple/swift-syntax/archive/75492a3ea7498572a30beb1e3c5cfb073da8e753.tar.gz",
strip_prefix = "swift-syntax-0519e76999c9e548e58222e45a22f177c886d8c0",
url = "https://github.com/apple/swift-syntax/archive/0519e76999c9e548e58222e45a22f177c886d8c0.tar.gz",
)

http_archive(
Expand Down

0 comments on commit e84430f

Please sign in to comment.