Skip to content

[SE-0376] Rename @_backDeploy(before:) to @backDeployed(before:) #1304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public let KEYWORDS: [KeywordSpec] = [
KeywordSpec("availability"),
KeywordSpec("available"),
KeywordSpec("await"),
KeywordSpec("backDeployed"),
KeywordSpec("before"),
KeywordSpec("block"),
KeywordSpec("break", isLexerClassified: true, requiresTrailingSpace: true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public let ATTRIBUTE_NODES: [Node] = [
kind: .node(kind: "DifferentiableAttributeArguments")),
Child(name: "DerivativeRegistrationArguments",
kind: .node(kind: "DerivativeRegistrationAttributeArguments")),
Child(name: "BackDeployArguments",
kind: .node(kind: "BackDeployAttributeSpecList")),
Child(name: "BackDeployedArguments",
kind: .node(kind: "BackDeployedAttributeSpecList")),
Child(name: "ConventionArguments",
kind: .node(kind: "ConventionAttributeArguments")),
Child(name: "ConventionWitnessMethodArguments",
Expand Down Expand Up @@ -340,9 +340,9 @@ public let ATTRIBUTE_NODES: [Node] = [
isOptional: true)
]),

Node(name: "BackDeployAttributeSpecList",
nameForDiagnostics: "'@_backDeploy' arguments",
description: "A collection of arguments for the `@_backDeploy` attribute",
Node(name: "BackDeployedAttributeSpecList",
nameForDiagnostics: "'@backDeployed' arguments",
description: "A collection of arguments for the `@backDeployed` attribute",
kind: "Syntax",
children: [
Child(name: "BeforeLabel",
Expand Down
19 changes: 10 additions & 9 deletions Sources/SwiftParser/Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ extension Parser {
/// Compiler-known attributes that take arguments.
enum DeclarationAttributeWithSpecialSyntax: RawTokenKindSubset {
case _alignment
case _backDeploy
case _cdecl
case _documentation
case _dynamicReplacement
Expand All @@ -56,6 +55,7 @@ extension Parser {
case _unavailableFromAsync
case `rethrows`
case available
case backDeployed
case derivative
case differentiable
case exclusivity
Expand All @@ -66,7 +66,7 @@ extension Parser {
init?(lexeme: Lexer.Lexeme) {
switch lexeme {
case RawTokenKindMatch(._alignment): self = ._alignment
case RawTokenKindMatch(._backDeploy): self = ._backDeploy
case RawTokenKindMatch(._backDeploy): self = .backDeployed
case RawTokenKindMatch(._cdecl): self = ._cdecl
case RawTokenKindMatch(._documentation): self = ._documentation
case RawTokenKindMatch(._dynamicReplacement): self = ._dynamicReplacement
Expand All @@ -90,6 +90,7 @@ extension Parser {
case RawTokenKindMatch(._unavailableFromAsync): self = ._unavailableFromAsync
case RawTokenKindMatch(.`rethrows`): self = .rethrows
case RawTokenKindMatch(.available): self = .available
case RawTokenKindMatch(.backDeployed): self = .backDeployed
case RawTokenKindMatch(.derivative): self = .derivative
case RawTokenKindMatch(.differentiable): self = .differentiable
case RawTokenKindMatch(.exclusivity): self = .exclusivity
Expand All @@ -104,7 +105,6 @@ extension Parser {
var rawTokenKind: RawTokenKind {
switch self {
case ._alignment: return .keyword(._alignment)
case ._backDeploy: return .keyword(._backDeploy)
case ._cdecl: return .keyword(._cdecl)
case ._documentation: return .keyword(._documentation)
case ._dynamicReplacement: return .keyword(._dynamicReplacement)
Expand All @@ -128,6 +128,7 @@ extension Parser {
case ._unavailableFromAsync: return .keyword(._unavailableFromAsync)
case .`rethrows`: return .keyword(.rethrows)
case .available: return .keyword(.available)
case .backDeployed: return .keyword(.backDeployed)
case .derivative: return .keyword(.derivative)
case .differentiable: return .keyword(.differentiable)
case .exclusivity: return .keyword(.exclusivity)
Expand Down Expand Up @@ -222,6 +223,10 @@ extension Parser {
return parseAttribute(argumentMode: .required) { parser in
return .availability(parser.parseAvailabilityArgumentSpecList())
}
case .backDeployed:
return parseAttribute(argumentMode: .required) { parser in
return .backDeployedArguments(parser.parseBackDeployedArguments())
}
case .differentiable:
return parseAttribute(argumentMode: .required) { parser in
return .differentiableArguments(parser.parseDifferentiableAttributeArguments())
Expand Down Expand Up @@ -294,10 +299,6 @@ extension Parser {
return parseAttribute(argumentMode: .required) { parser in
return .string(parser.parseStringLiteral())
}
case ._backDeploy:
return parseAttribute(argumentMode: .required) { parser in
return .backDeployArguments(parser.parseBackDeployArguments())
}
case ._expose:
return parseAttribute(argumentMode: .required) { parser in
return .exposeAttributeArguments(parser.parseExposeArguments())
Expand Down Expand Up @@ -920,7 +921,7 @@ extension Parser {
}

extension Parser {
mutating func parseBackDeployArguments() -> RawBackDeployAttributeSpecListSyntax {
mutating func parseBackDeployedArguments() -> RawBackDeployedAttributeSpecListSyntax {
let (unexpectedBeforeLabel, label) = self.expect(.keyword(.before))
let (unexpectedBeforeColon, colon) = self.expect(.colon)
var elements: [RawAvailabilityVersionRestrictionListEntrySyntax] = []
Expand All @@ -936,7 +937,7 @@ extension Parser {
)
)
} while keepGoing != nil
return RawBackDeployAttributeSpecListSyntax(
return RawBackDeployedAttributeSpecListSyntax(
unexpectedBeforeLabel,
beforeLabel: label,
unexpectedBeforeColon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
- <doc:SwiftSyntax/DifferentiabilityParamSyntax>
- <doc:SwiftSyntax/DerivativeRegistrationAttributeArgumentsSyntax>
- <doc:SwiftSyntax/QualifiedDeclNameSyntax>
- <doc:SwiftSyntax/BackDeployAttributeSpecListSyntax>
- <doc:SwiftSyntax/BackDeployedAttributeSpecListSyntax>
- <doc:SwiftSyntax/AvailabilityVersionRestrictionListSyntax>
- <doc:SwiftSyntax/AvailabilityVersionRestrictionListEntrySyntax>
- <doc:SwiftSyntax/OpaqueReturnTypeOfAttributeArgumentsSyntax>
Expand Down
16 changes: 8 additions & 8 deletions Sources/SwiftSyntax/Raw/gyb_generated/RawSyntaxNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10573,7 +10573,7 @@ public struct RawAttributeSyntax: RawSyntaxNodeProtocol {
case `implementsArguments`(RawImplementsAttributeArgumentsSyntax)
case `differentiableArguments`(RawDifferentiableAttributeArgumentsSyntax)
case `derivativeRegistrationArguments`(RawDerivativeRegistrationAttributeArgumentsSyntax)
case `backDeployArguments`(RawBackDeployAttributeSpecListSyntax)
case `backDeployedArguments`(RawBackDeployedAttributeSpecListSyntax)
case `conventionArguments`(RawConventionAttributeArgumentsSyntax)
case `conventionWitnessMethodArguments`(RawConventionWitnessMethodAttributeArgumentsSyntax)
case `opaqueReturnTypeOfAttributeArguments`(RawOpaqueReturnTypeOfAttributeArgumentsSyntax)
Expand All @@ -10586,7 +10586,7 @@ public struct RawAttributeSyntax: RawSyntaxNodeProtocol {
case `documentationArguments`(RawDocumentationAttributeArgumentsSyntax)

public static func isKindOf(_ raw: RawSyntax) -> Bool {
return RawTupleExprElementListSyntax.isKindOf(raw) || RawTokenSyntax.isKindOf(raw) || RawStringLiteralExprSyntax.isKindOf(raw) || RawAvailabilitySpecListSyntax.isKindOf(raw) || RawSpecializeAttributeSpecListSyntax.isKindOf(raw) || RawObjCSelectorSyntax.isKindOf(raw) || RawImplementsAttributeArgumentsSyntax.isKindOf(raw) || RawDifferentiableAttributeArgumentsSyntax.isKindOf(raw) || RawDerivativeRegistrationAttributeArgumentsSyntax.isKindOf(raw) || RawBackDeployAttributeSpecListSyntax.isKindOf(raw) || RawConventionAttributeArgumentsSyntax.isKindOf(raw) || RawConventionWitnessMethodAttributeArgumentsSyntax.isKindOf(raw) || RawOpaqueReturnTypeOfAttributeArgumentsSyntax.isKindOf(raw) || RawExposeAttributeArgumentsSyntax.isKindOf(raw) || RawOriginallyDefinedInArgumentsSyntax.isKindOf(raw) || RawUnderscorePrivateAttributeArgumentsSyntax.isKindOf(raw) || RawDynamicReplacementArgumentsSyntax.isKindOf(raw) || RawUnavailableFromAsyncArgumentsSyntax.isKindOf(raw) || RawEffectsArgumentsSyntax.isKindOf(raw) || RawDocumentationAttributeArgumentsSyntax.isKindOf(raw)
return RawTupleExprElementListSyntax.isKindOf(raw) || RawTokenSyntax.isKindOf(raw) || RawStringLiteralExprSyntax.isKindOf(raw) || RawAvailabilitySpecListSyntax.isKindOf(raw) || RawSpecializeAttributeSpecListSyntax.isKindOf(raw) || RawObjCSelectorSyntax.isKindOf(raw) || RawImplementsAttributeArgumentsSyntax.isKindOf(raw) || RawDifferentiableAttributeArgumentsSyntax.isKindOf(raw) || RawDerivativeRegistrationAttributeArgumentsSyntax.isKindOf(raw) || RawBackDeployedAttributeSpecListSyntax.isKindOf(raw) || RawConventionAttributeArgumentsSyntax.isKindOf(raw) || RawConventionWitnessMethodAttributeArgumentsSyntax.isKindOf(raw) || RawOpaqueReturnTypeOfAttributeArgumentsSyntax.isKindOf(raw) || RawExposeAttributeArgumentsSyntax.isKindOf(raw) || RawOriginallyDefinedInArgumentsSyntax.isKindOf(raw) || RawUnderscorePrivateAttributeArgumentsSyntax.isKindOf(raw) || RawDynamicReplacementArgumentsSyntax.isKindOf(raw) || RawUnavailableFromAsyncArgumentsSyntax.isKindOf(raw) || RawEffectsArgumentsSyntax.isKindOf(raw) || RawDocumentationAttributeArgumentsSyntax.isKindOf(raw)
}

public var raw: RawSyntax {
Expand All @@ -10600,7 +10600,7 @@ public struct RawAttributeSyntax: RawSyntaxNodeProtocol {
case .implementsArguments(let node): return node.raw
case .differentiableArguments(let node): return node.raw
case .derivativeRegistrationArguments(let node): return node.raw
case .backDeployArguments(let node): return node.raw
case .backDeployedArguments(let node): return node.raw
case .conventionArguments(let node): return node.raw
case .conventionWitnessMethodArguments(let node): return node.raw
case .opaqueReturnTypeOfAttributeArguments(let node): return node.raw
Expand Down Expand Up @@ -10651,8 +10651,8 @@ public struct RawAttributeSyntax: RawSyntaxNodeProtocol {
self = .derivativeRegistrationArguments(node)
return
}
if let node = RawBackDeployAttributeSpecListSyntax(other) {
self = .backDeployArguments(node)
if let node = RawBackDeployedAttributeSpecListSyntax(other) {
self = .backDeployedArguments(node)
return
}
if let node = RawConventionAttributeArgumentsSyntax(other) {
Expand Down Expand Up @@ -11999,15 +11999,15 @@ public struct RawQualifiedDeclNameSyntax: RawSyntaxNodeProtocol {
}

@_spi(RawSyntax)
public struct RawBackDeployAttributeSpecListSyntax: RawSyntaxNodeProtocol {
public struct RawBackDeployedAttributeSpecListSyntax: RawSyntaxNodeProtocol {

@_spi(RawSyntax)
public var layoutView: RawSyntaxLayoutView {
return raw.layoutView!
}

public static func isKindOf(_ raw: RawSyntax) -> Bool {
return raw.kind == .backDeployAttributeSpecList
return raw.kind == .backDeployedAttributeSpecList
}

public var raw: RawSyntax
Expand All @@ -12034,7 +12034,7 @@ public struct RawBackDeployAttributeSpecListSyntax: RawSyntaxNodeProtocol {
assert(beforeLabel.tokenKind == .keyword(.before), "Received \(beforeLabel.tokenKind)")
assert(colon.tokenKind.base == .colon, "Received \(colon.tokenKind)")
let raw = RawSyntax.makeLayout(
kind: .backDeployAttributeSpecList, uninitializedCount: 7, arena: arena) { layout in
kind: .backDeployedAttributeSpecList, uninitializedCount: 7, arena: arena) { layout in
layout.initialize(repeating: nil)
layout[0] = unexpectedBeforeBeforeLabel?.raw
layout[1] = beforeLabel.raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
assertNoError(kind, 7, verify(layout[7], as: RawDeclNameArgumentsSyntax?.self))
assertNoError(kind, 8, verify(layout[8], as: RawUnexpectedNodesSyntax?.self))
break
case .backDeployAttributeSpecList:
case .backDeployedAttributeSpecList:
assert(layout.count == 7)
assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self))
assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax.self))
Expand Down
5 changes: 5 additions & 0 deletions Sources/SwiftSyntax/generated/Keyword.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public enum Keyword: UInt8, Hashable {

case await

case backDeployed

case before

case block
Expand Down Expand Up @@ -789,6 +791,8 @@ public enum Keyword: UInt8, Hashable {
self = ._silgen_name
case "availability":
self = .availability
case "backDeployed":
self = .backDeployed
case "noDerivative":
self = .noDerivative
default:
Expand Down Expand Up @@ -1096,6 +1100,7 @@ public enum Keyword: UInt8, Hashable {
"availability",
"available",
"await",
"backDeployed",
"before",
"block",
"break",
Expand Down
10 changes: 5 additions & 5 deletions Sources/SwiftSyntax/generated/Misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension Syntax {
.node(AvailabilityVersionRestrictionListSyntax.self),
.node(AvailabilityVersionRestrictionSyntax.self),
.node(AwaitExprSyntax.self),
.node(BackDeployAttributeSpecListSyntax.self),
.node(BackDeployedAttributeSpecListSyntax.self),
.node(BinaryOperatorExprSyntax.self),
.node(BooleanLiteralExprSyntax.self),
.node(BorrowExprSyntax.self),
Expand Down Expand Up @@ -340,8 +340,8 @@ extension SyntaxKind {
return AvailabilityVersionRestrictionSyntax.self
case .awaitExpr:
return AwaitExprSyntax.self
case .backDeployAttributeSpecList:
return BackDeployAttributeSpecListSyntax.self
case .backDeployedAttributeSpecList:
return BackDeployedAttributeSpecListSyntax.self
case .binaryOperatorExpr:
return BinaryOperatorExprSyntax.self
case .booleanLiteralExpr:
Expand Down Expand Up @@ -865,8 +865,8 @@ extension SyntaxKind {
return "version restriction"
case .awaitExpr:
return "'await' expression"
case .backDeployAttributeSpecList:
return "'@_backDeploy' arguments"
case .backDeployedAttributeSpecList:
return "'@backDeployed' arguments"
case .binaryOperatorExpr:
return "operator"
case .booleanLiteralExpr:
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
visitAnyPost(node._syntaxNode)
}

override open func visit(_ node: BackDeployAttributeSpecListSyntax) -> SyntaxVisitorContinueKind {
override open func visit(_ node: BackDeployedAttributeSpecListSyntax) -> SyntaxVisitorContinueKind {
return visitAny(node._syntaxNode)
}

override open func visitPost(_ node: BackDeployAttributeSpecListSyntax) {
override open func visitPost(_ node: BackDeployedAttributeSpecListSyntax) {
visitAnyPost(node._syntaxNode)
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftSyntax/generated/SyntaxEnum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public enum SyntaxEnum {

case awaitExpr(AwaitExprSyntax)

case backDeployAttributeSpecList(BackDeployAttributeSpecListSyntax)
case backDeployedAttributeSpecList(BackDeployedAttributeSpecListSyntax)

case binaryOperatorExpr(BinaryOperatorExprSyntax)

Expand Down Expand Up @@ -598,8 +598,8 @@ public extension Syntax {
return .availabilityVersionRestriction(AvailabilityVersionRestrictionSyntax(self)!)
case .awaitExpr:
return .awaitExpr(AwaitExprSyntax(self)!)
case .backDeployAttributeSpecList:
return .backDeployAttributeSpecList(BackDeployAttributeSpecListSyntax(self)!)
case .backDeployedAttributeSpecList:
return .backDeployedAttributeSpecList(BackDeployedAttributeSpecListSyntax(self)!)
case .binaryOperatorExpr:
return .binaryOperatorExpr(BinaryOperatorExprSyntax(self)!)
case .booleanLiteralExpr:
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftSyntax/generated/SyntaxKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public enum SyntaxKind {

case awaitExpr

case backDeployAttributeSpecList
case backDeployedAttributeSpecList

case binaryOperatorExpr

Expand Down
18 changes: 9 additions & 9 deletions Sources/SwiftSyntax/generated/SyntaxRewriter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ open class SyntaxRewriter {
return ExprSyntax(visitChildren(node))
}

/// Visit a `BackDeployAttributeSpecListSyntax`.
/// Visit a `BackDeployedAttributeSpecListSyntax`.
/// - Parameter node: the node that is being visited
/// - Returns: the rewritten node
open func visit(_ node: BackDeployAttributeSpecListSyntax) -> BackDeployAttributeSpecListSyntax {
return Syntax(visitChildren(node)).cast(BackDeployAttributeSpecListSyntax.self)
open func visit(_ node: BackDeployedAttributeSpecListSyntax) -> BackDeployedAttributeSpecListSyntax {
return Syntax(visitChildren(node)).cast(BackDeployedAttributeSpecListSyntax.self)
}

/// Visit a `BinaryOperatorExprSyntax`.
Expand Down Expand Up @@ -2293,8 +2293,8 @@ open class SyntaxRewriter {
}

/// Implementation detail of visit(_:). Do not call directly.
private func visitImplBackDeployAttributeSpecListSyntax(_ data: SyntaxData) -> Syntax {
let node = BackDeployAttributeSpecListSyntax(data)
private func visitImplBackDeployedAttributeSpecListSyntax(_ data: SyntaxData) -> Syntax {
let node = BackDeployedAttributeSpecListSyntax(data)
// Accessing _syntaxNode directly is faster than calling Syntax(node)
visitPre(node._syntaxNode)
defer {
Expand Down Expand Up @@ -5636,8 +5636,8 @@ open class SyntaxRewriter {
return visitImplAvailabilityVersionRestrictionSyntax
case .awaitExpr:
return visitImplAwaitExprSyntax
case .backDeployAttributeSpecList:
return visitImplBackDeployAttributeSpecListSyntax
case .backDeployedAttributeSpecList:
return visitImplBackDeployedAttributeSpecListSyntax
case .binaryOperatorExpr:
return visitImplBinaryOperatorExprSyntax
case .booleanLiteralExpr:
Expand Down Expand Up @@ -6164,8 +6164,8 @@ open class SyntaxRewriter {
return visitImplAvailabilityVersionRestrictionSyntax(data)
case .awaitExpr:
return visitImplAwaitExprSyntax(data)
case .backDeployAttributeSpecList:
return visitImplBackDeployAttributeSpecListSyntax(data)
case .backDeployedAttributeSpecList:
return visitImplBackDeployedAttributeSpecListSyntax(data)
case .binaryOperatorExpr:
return visitImplBinaryOperatorExprSyntax(data)
case .booleanLiteralExpr:
Expand Down
10 changes: 5 additions & 5 deletions Sources/SwiftSyntax/generated/SyntaxTransform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ public protocol SyntaxTransformVisitor {
/// - Returns: the sum of whatever the child visitors return.
func visit(_ node: AwaitExprSyntax) -> ResultType

/// Visiting `BackDeployAttributeSpecListSyntax` specifically.
/// Visiting `BackDeployedAttributeSpecListSyntax` specifically.
/// - Parameter node: the node we are visiting.
/// - Returns: the sum of whatever the child visitors return.
func visit(_ node: BackDeployAttributeSpecListSyntax) -> ResultType
func visit(_ node: BackDeployedAttributeSpecListSyntax) -> ResultType

/// Visiting `BinaryOperatorExprSyntax` specifically.
/// - Parameter node: the node we are visiting.
Expand Down Expand Up @@ -1511,10 +1511,10 @@ extension SyntaxTransformVisitor {
visitAny(Syntax(node))
}

/// Visiting `BackDeployAttributeSpecListSyntax` specifically.
/// Visiting `BackDeployedAttributeSpecListSyntax` specifically.
/// - Parameter node: the node we are visiting.
/// - Returns: nil by default.
public func visit(_ node: BackDeployAttributeSpecListSyntax) -> ResultType {
public func visit(_ node: BackDeployedAttributeSpecListSyntax) -> ResultType {
visitAny(Syntax(node))
}

Expand Down Expand Up @@ -3193,7 +3193,7 @@ extension SyntaxTransformVisitor {
return visit(derived)
case .awaitExpr(let derived):
return visit(derived)
case .backDeployAttributeSpecList(let derived):
case .backDeployedAttributeSpecList(let derived):
return visit(derived)
case .binaryOperatorExpr(let derived):
return visit(derived)
Expand Down
Loading