Skip to content

Commit c02bf11

Browse files
authored
Merge pull request #2023 from ahoppen/ahoppen/uppercase-deprecated-name
Ensure that the `deprecatedName` starts with an uppercase letter
2 parents 83348e7 + 1a77228 commit c02bf11

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

CodeGeneration/Sources/SyntaxSupport/Child.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,8 @@ public class Child {
185185
documentation: String? = nil,
186186
isOptional: Bool = false
187187
) {
188-
if let firstCharInName = name.first {
189-
precondition(firstCharInName.isUppercase == true, "The first letter of a child’s name should be uppercase")
190-
}
188+
precondition(name.first?.isUppercase ?? true, "The first letter of a child’s name should be uppercase")
189+
precondition(deprecatedName?.first?.isUppercase ?? true, "The first letter of a child’s name should be uppercase")
191190
self.name = name
192191
self.deprecatedName = deprecatedName
193192
self.kind = kind

CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public let TYPE_NODES: [Node] = [
192192
),
193193
Child(
194194
name: "Parameters",
195-
deprecatedName: "arguments",
195+
deprecatedName: "Arguments",
196196
kind: .collection(kind: .tupleTypeElementList, collectionElementName: "Parameter", deprecatedCollectionElementName: "Argument")
197197
),
198198
Child(

Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,7 +3361,7 @@ extension FunctionSignatureSyntax {
33613361

33623362
extension FunctionTypeSyntax {
33633363
@available(*, deprecated, renamed: "unexpectedBetweenLeftParenAndParameters")
3364-
public var unexpectedBetweenLeftParenAndarguments: UnexpectedNodesSyntax? {
3364+
public var unexpectedBetweenLeftParenAndArguments: UnexpectedNodesSyntax? {
33653365
get {
33663366
return unexpectedBetweenLeftParenAndParameters
33673367
}
@@ -3386,7 +3386,7 @@ extension FunctionTypeSyntax {
33863386
}
33873387

33883388
@available(*, deprecated, renamed: "unexpectedBetweenParametersAndRightParen")
3389-
public var unexpectedBetweenargumentsAndRightParen: UnexpectedNodesSyntax? {
3389+
public var unexpectedBetweenArgumentsAndRightParen: UnexpectedNodesSyntax? {
33903390
get {
33913391
return unexpectedBetweenParametersAndRightParen
33923392
}
@@ -3431,9 +3431,9 @@ extension FunctionTypeSyntax {
34313431
leadingTrivia: Trivia? = nil,
34323432
_ unexpectedBeforeLeftParen: UnexpectedNodesSyntax? = nil,
34333433
leftParen: TokenSyntax = .leftParenToken(),
3434-
_ unexpectedBetweenLeftParenAndarguments: UnexpectedNodesSyntax? = nil,
3434+
_ unexpectedBetweenLeftParenAndArguments: UnexpectedNodesSyntax? = nil,
34353435
arguments: TupleTypeElementListSyntax,
3436-
_ unexpectedBetweenargumentsAndRightParen: UnexpectedNodesSyntax? = nil,
3436+
_ unexpectedBetweenArgumentsAndRightParen: UnexpectedNodesSyntax? = nil,
34373437
rightParen: TokenSyntax = .rightParenToken(),
34383438
_ unexpectedBetweenRightParenAndEffectSpecifiers: UnexpectedNodesSyntax? = nil,
34393439
effectSpecifiers: TypeEffectSpecifiersSyntax? = nil,
@@ -3447,9 +3447,9 @@ extension FunctionTypeSyntax {
34473447
leadingTrivia: leadingTrivia,
34483448
unexpectedBeforeLeftParen,
34493449
leftParen: leftParen,
3450-
unexpectedBetweenLeftParenAndarguments,
3450+
unexpectedBetweenLeftParenAndArguments,
34513451
parameters: arguments,
3452-
unexpectedBetweenargumentsAndRightParen,
3452+
unexpectedBetweenArgumentsAndRightParen,
34533453
rightParen: rightParen,
34543454
unexpectedBetweenRightParenAndEffectSpecifiers,
34553455
effectSpecifiers: effectSpecifiers,

0 commit comments

Comments
 (0)