Skip to content

Commit 86f2f5c

Browse files
authored
Merge pull request swiftlang#179 from dan-zheng/upstream-differentiable-attr
[AutoDiff upstream] Update gyb-generated files.
2 parents fbf4777 + e1b4cc6 commit 86f2f5c

File tree

4 files changed

+13
-87
lines changed

4 files changed

+13
-87
lines changed

Diff for: Sources/SwiftSyntax/gyb_generated/Misc.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,6 @@ extension Syntax {
18781878
extension SyntaxParser {
18791879
static func verifyNodeDeclarationHash() -> Bool {
18801880
return String(cString: swiftparse_syntax_structure_versioning_identifier()!) ==
1881-
"274521544372836110"
1881+
"3924247553615556843"
18821882
}
18831883
}

Diff for: Sources/SwiftSyntax/gyb_generated/SyntaxBuilders.swift

+1-11
Original file line numberDiff line numberDiff line change
@@ -6225,7 +6225,7 @@ extension ObjCSelectorPieceSyntax {
62256225

62266226
public struct DifferentiableAttributeArgumentsSyntaxBuilder {
62276227
private var layout =
6228-
Array<RawSyntax?>(repeating: nil, count: 7)
6228+
Array<RawSyntax?>(repeating: nil, count: 5)
62296229

62306230
internal init() {}
62316231

@@ -6239,16 +6239,6 @@ public struct DifferentiableAttributeArgumentsSyntaxBuilder {
62396239
layout[idx] = node.raw
62406240
}
62416241

6242-
public mutating func useMaybePrimal(_ node: DifferentiableAttributeFuncSpecifierSyntax) {
6243-
let idx = DifferentiableAttributeArgumentsSyntax.Cursor.maybePrimal.rawValue
6244-
layout[idx] = node.raw
6245-
}
6246-
6247-
public mutating func useMaybeAdjoint(_ node: DifferentiableAttributeFuncSpecifierSyntax) {
6248-
let idx = DifferentiableAttributeArgumentsSyntax.Cursor.maybeAdjoint.rawValue
6249-
layout[idx] = node.raw
6250-
}
6251-
62526242
public mutating func useMaybeJVP(_ node: DifferentiableAttributeFuncSpecifierSyntax) {
62536243
let idx = DifferentiableAttributeArgumentsSyntax.Cursor.maybeJVP.rawValue
62546244
layout[idx] = node.raw

Diff for: Sources/SwiftSyntax/gyb_generated/SyntaxFactory.swift

+1-5
Original file line numberDiff line numberDiff line change
@@ -2853,12 +2853,10 @@ public enum SyntaxFactory {
28532853
], length: .zero, presence: .present))
28542854
return ObjCSelectorSyntax(data)
28552855
}
2856-
public static func makeDifferentiableAttributeArguments(diffParams: DifferentiationParamsClauseSyntax?, diffParamsComma: TokenSyntax?, maybePrimal: DifferentiableAttributeFuncSpecifierSyntax?, maybeAdjoint: DifferentiableAttributeFuncSpecifierSyntax?, maybeJVP: DifferentiableAttributeFuncSpecifierSyntax?, maybeVJP: DifferentiableAttributeFuncSpecifierSyntax?, whereClause: GenericWhereClauseSyntax?) -> DifferentiableAttributeArgumentsSyntax {
2856+
public static func makeDifferentiableAttributeArguments(diffParams: DifferentiationParamsClauseSyntax?, diffParamsComma: TokenSyntax?, maybeJVP: DifferentiableAttributeFuncSpecifierSyntax?, maybeVJP: DifferentiableAttributeFuncSpecifierSyntax?, whereClause: GenericWhereClauseSyntax?) -> DifferentiableAttributeArgumentsSyntax {
28572857
let layout: [RawSyntax?] = [
28582858
diffParams?.raw,
28592859
diffParamsComma?.raw,
2860-
maybePrimal?.raw,
2861-
maybeAdjoint?.raw,
28622860
maybeJVP?.raw,
28632861
maybeVJP?.raw,
28642862
whereClause?.raw,
@@ -2877,8 +2875,6 @@ public enum SyntaxFactory {
28772875
nil,
28782876
nil,
28792877
nil,
2880-
nil,
2881-
nil,
28822878
], length: .zero, presence: .present))
28832879
return DifferentiableAttributeArgumentsSyntax(data)
28842880
}

Diff for: Sources/SwiftSyntax/gyb_generated/syntax_nodes/SyntaxNodes.swift

+10-70
Original file line numberDiff line numberDiff line change
@@ -6904,14 +6904,13 @@ extension ObjCSelectorPieceSyntax: CustomReflectable {
69046904
// MARK: - DifferentiableAttributeArgumentsSyntax
69056905

69066906
///
6907-
/// The arguments for the `@differentiable` attribute: an optional differentiation parameter list and associated functions.
6907+
/// The arguments for the `@differentiable` attribute: an optional
6908+
/// differentiation parameter list and associated functions.
69086909
///
69096910
public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable {
69106911
enum Cursor: Int {
69116912
case diffParams
69126913
case diffParamsComma
6913-
case maybePrimal
6914-
case maybeAdjoint
69156914
case maybeJVP
69166915
case maybeVJP
69176916
case whereClause
@@ -6982,50 +6981,6 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash
69826981
return DifferentiableAttributeArgumentsSyntax(newData)
69836982
}
69846983

6985-
public var maybePrimal: DifferentiableAttributeFuncSpecifierSyntax? {
6986-
get {
6987-
let childData = data.child(at: Cursor.maybePrimal,
6988-
parent: Syntax(self))
6989-
if childData == nil { return nil }
6990-
return DifferentiableAttributeFuncSpecifierSyntax(childData!)
6991-
}
6992-
set(value) {
6993-
self = withMaybePrimal(value)
6994-
}
6995-
}
6996-
6997-
/// Returns a copy of the receiver with its `maybePrimal` replaced.
6998-
/// - param newChild: The new `maybePrimal` to replace the node's
6999-
/// current `maybePrimal`, if present.
7000-
public func withMaybePrimal(
7001-
_ newChild: DifferentiableAttributeFuncSpecifierSyntax?) -> DifferentiableAttributeArgumentsSyntax {
7002-
let raw = newChild?.raw
7003-
let newData = data.replacingChild(raw, at: Cursor.maybePrimal)
7004-
return DifferentiableAttributeArgumentsSyntax(newData)
7005-
}
7006-
7007-
public var maybeAdjoint: DifferentiableAttributeFuncSpecifierSyntax? {
7008-
get {
7009-
let childData = data.child(at: Cursor.maybeAdjoint,
7010-
parent: Syntax(self))
7011-
if childData == nil { return nil }
7012-
return DifferentiableAttributeFuncSpecifierSyntax(childData!)
7013-
}
7014-
set(value) {
7015-
self = withMaybeAdjoint(value)
7016-
}
7017-
}
7018-
7019-
/// Returns a copy of the receiver with its `maybeAdjoint` replaced.
7020-
/// - param newChild: The new `maybeAdjoint` to replace the node's
7021-
/// current `maybeAdjoint`, if present.
7022-
public func withMaybeAdjoint(
7023-
_ newChild: DifferentiableAttributeFuncSpecifierSyntax?) -> DifferentiableAttributeArgumentsSyntax {
7024-
let raw = newChild?.raw
7025-
let newData = data.replacingChild(raw, at: Cursor.maybeAdjoint)
7026-
return DifferentiableAttributeArgumentsSyntax(newData)
7027-
}
7028-
70296984
public var maybeJVP: DifferentiableAttributeFuncSpecifierSyntax? {
70306985
get {
70316986
let childData = data.child(at: Cursor.maybeJVP,
@@ -7095,7 +7050,7 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash
70957050

70967051
public func _validateLayout() {
70977052
let rawChildren = Array(RawSyntaxChildren(Syntax(self)))
7098-
assert(rawChildren.count == 7)
7053+
assert(rawChildren.count == 5)
70997054
// Check child #0 child is DifferentiationParamsClauseSyntax or missing
71007055
if let raw = rawChildren[0].raw {
71017056
let info = rawChildren[0].syntaxInfo
@@ -7128,28 +7083,12 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash
71287083
let syntaxChild = Syntax(syntaxData)
71297084
assert(syntaxChild.is(DifferentiableAttributeFuncSpecifierSyntax.self))
71307085
}
7131-
// Check child #4 child is DifferentiableAttributeFuncSpecifierSyntax or missing
7086+
// Check child #4 child is GenericWhereClauseSyntax or missing
71327087
if let raw = rawChildren[4].raw {
71337088
let info = rawChildren[4].syntaxInfo
71347089
let absoluteRaw = AbsoluteRawSyntax(raw: raw, info: info)
71357090
let syntaxData = SyntaxData(absoluteRaw, parent: Syntax(self))
71367091
let syntaxChild = Syntax(syntaxData)
7137-
assert(syntaxChild.is(DifferentiableAttributeFuncSpecifierSyntax.self))
7138-
}
7139-
// Check child #5 child is DifferentiableAttributeFuncSpecifierSyntax or missing
7140-
if let raw = rawChildren[5].raw {
7141-
let info = rawChildren[5].syntaxInfo
7142-
let absoluteRaw = AbsoluteRawSyntax(raw: raw, info: info)
7143-
let syntaxData = SyntaxData(absoluteRaw, parent: Syntax(self))
7144-
let syntaxChild = Syntax(syntaxData)
7145-
assert(syntaxChild.is(DifferentiableAttributeFuncSpecifierSyntax.self))
7146-
}
7147-
// Check child #6 child is GenericWhereClauseSyntax or missing
7148-
if let raw = rawChildren[6].raw {
7149-
let info = rawChildren[6].syntaxInfo
7150-
let absoluteRaw = AbsoluteRawSyntax(raw: raw, info: info)
7151-
let syntaxData = SyntaxData(absoluteRaw, parent: Syntax(self))
7152-
let syntaxChild = Syntax(syntaxData)
71537092
assert(syntaxChild.is(GenericWhereClauseSyntax.self))
71547093
}
71557094
}
@@ -7160,8 +7099,6 @@ extension DifferentiableAttributeArgumentsSyntax: CustomReflectable {
71607099
return Mirror(self, children: [
71617100
"diffParams": diffParams.map(Syntax.init)?.as(SyntaxProtocol.self) as Any,
71627101
"diffParamsComma": diffParamsComma.map(Syntax.init)?.as(SyntaxProtocol.self) as Any,
7163-
"maybePrimal": maybePrimal.map(Syntax.init)?.as(SyntaxProtocol.self) as Any,
7164-
"maybeAdjoint": maybeAdjoint.map(Syntax.init)?.as(SyntaxProtocol.self) as Any,
71657102
"maybeJVP": maybeJVP.map(Syntax.init)?.as(SyntaxProtocol.self) as Any,
71667103
"maybeVJP": maybeVJP.map(Syntax.init)?.as(SyntaxProtocol.self) as Any,
71677104
"whereClause": whereClause.map(Syntax.init)?.as(SyntaxProtocol.self) as Any,
@@ -7464,7 +7401,8 @@ extension DifferentiationParamsSyntax: CustomReflectable {
74647401
// MARK: - DifferentiationParamSyntax
74657402

74667403
///
7467-
/// A differentiation parameter: either the "self" identifier or a function parameter name.
7404+
/// A differentiation parameter: either the "self" identifier or a
7405+
/// function parameter name.
74687406
///
74697407
public struct DifferentiationParamSyntax: SyntaxProtocol, SyntaxHashable {
74707408
enum Cursor: Int {
@@ -7568,7 +7506,8 @@ extension DifferentiationParamSyntax: CustomReflectable {
75687506
// MARK: - DifferentiableAttributeFuncSpecifierSyntax
75697507

75707508
///
7571-
/// A function specifier, consisting of an identifier, colon, and a function declaration name (e.g. `vjp: foo(_:_:)`).
7509+
/// A function specifier, consisting of an identifier, colon, and a
7510+
/// function declaration name (e.g. `vjp: foo(_:_:)`).
75727511
///
75737512
public struct DifferentiableAttributeFuncSpecifierSyntax: SyntaxProtocol, SyntaxHashable {
75747513
enum Cursor: Int {
@@ -7785,7 +7724,8 @@ public struct FunctionDeclNameSyntax: SyntaxProtocol, SyntaxHashable {
77857724
}
77867725

77877726
///
7788-
/// The argument labels of the referenced function, optionally specified.
7727+
/// The argument labels of the referenced function, optionally
7728+
/// specified.
77897729
///
77907730
public var arguments: DeclNameArgumentsSyntax? {
77917731
get {

0 commit comments

Comments
 (0)