Update SwiftSyntax (#4639)
* `ObjcKeyPathExprSyntax` -> `MacroExpansionExprSyntax` * Fix `#selector()` and add a regression test Co-authored-by: JP Simard <jp@jpsim.com>
This commit is contained in:
parent
53ee4a955d
commit
25c3fb161d
|
@ -32,7 +32,7 @@
|
|||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-syntax.git",
|
||||
"state" : {
|
||||
"revision" : "76d01195182593ff34f5ada1ab0910fae190fc9c"
|
||||
"revision" : "6fcc5a4b897351766da9dca9d14e26897ca17dc7"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ let package = Package(
|
|||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.2.0")),
|
||||
.package(url: "https://github.com/apple/swift-syntax.git", revision: "76d01195182593ff34f5ada1ab0910fae190fc9c"),
|
||||
.package(url: "https://github.com/apple/swift-syntax.git", revision: "6fcc5a4b897351766da9dca9d14e26897ca17dc7"),
|
||||
.package(url: "https://github.com/jpsim/SourceKitten.git", .upToNextMinor(from: "0.33.1")),
|
||||
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.1"),
|
||||
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"),
|
||||
|
|
|
@ -83,6 +83,17 @@ struct PreferSelfInStaticReferencesRule: SwiftSyntaxRule, CorrectableRule, Confi
|
|||
""", excludeFromDocumentation: true)
|
||||
],
|
||||
triggeringExamples: [
|
||||
Example("""
|
||||
final class CheckCellView: NSTableCellView {
|
||||
@IBOutlet var checkButton: NSButton!
|
||||
|
||||
override func awakeFromNib() {
|
||||
checkButton.action = #selector(↓CheckCellView.check(_:))
|
||||
}
|
||||
|
||||
@objc func check(_ button: AnyObject?) {}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
class C {
|
||||
struct S {
|
||||
|
@ -146,6 +157,28 @@ struct PreferSelfInStaticReferencesRule: SwiftSyntaxRule, CorrectableRule, Confi
|
|||
""", excludeFromDocumentation: true)
|
||||
],
|
||||
corrections: [
|
||||
Example("""
|
||||
final class CheckCellView: NSTableCellView {
|
||||
@IBOutlet var checkButton: NSButton!
|
||||
|
||||
override func awakeFromNib() {
|
||||
checkButton.action = #selector(↓CheckCellView.check(_:))
|
||||
}
|
||||
|
||||
@objc func check(_ button: AnyObject?) {}
|
||||
}
|
||||
"""):
|
||||
Example("""
|
||||
final class CheckCellView: NSTableCellView {
|
||||
@IBOutlet var checkButton: NSButton!
|
||||
|
||||
override func awakeFromNib() {
|
||||
checkButton.action = #selector(Self.check(_:))
|
||||
}
|
||||
|
||||
@objc func check(_ button: AnyObject?) {}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
struct S {
|
||||
static let i = 1
|
||||
|
@ -296,8 +329,8 @@ private class Visitor: ViolationsSyntaxVisitor {
|
|||
_ = variableDeclScopes.popLast()
|
||||
}
|
||||
|
||||
override func visit(_ node: ObjcKeyPathExprSyntax) -> SyntaxVisitorContinueKind {
|
||||
if case .likeStruct = parentDeclScopes.last {
|
||||
override func visit(_ node: MacroExpansionExprSyntax) -> SyntaxVisitorContinueKind {
|
||||
if case .likeClass = parentDeclScopes.last, case .identifier("selector") = node.macro.tokenKind {
|
||||
return .visitChildren
|
||||
}
|
||||
return .skipChildren
|
||||
|
|
|
@ -19,10 +19,10 @@ def swiftlint_repos():
|
|||
|
||||
http_archive(
|
||||
name = "com_github_apple_swift_syntax",
|
||||
sha256 = "4f244c3acac972817579517d8799c702e5c36d223ab8ab596d9b63010e35e1c6", # SwiftSyntax sha256
|
||||
sha256 = "17bdf4c9c87bac4f7160be1ca2e4e0101f97f7b75181e18df62b3e425ea753d8", # SwiftSyntax sha256
|
||||
build_file = "@SwiftLint//bazel:SwiftSyntax.BUILD",
|
||||
strip_prefix = "swift-syntax-76d01195182593ff34f5ada1ab0910fae190fc9c",
|
||||
url = "https://github.com/apple/swift-syntax/archive/76d01195182593ff34f5ada1ab0910fae190fc9c.tar.gz",
|
||||
strip_prefix = "swift-syntax-6fcc5a4b897351766da9dca9d14e26897ca17dc7",
|
||||
url = "https://github.com/apple/swift-syntax/archive/6fcc5a4b897351766da9dca9d14e26897ca17dc7.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
|
|
Loading…
Reference in New Issue