Skip to content

Commit 746f0c3

Browse files
committed
Add missing trait conformances
These trait conformances were simply missing. Add them. rdar://110818997
1 parent be4a332 commit 746f0c3

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ public let ATTRIBUTE_NODES: [Node] = [
187187
nameForDiagnostics: "version",
188188
description: "A single platform/version pair in an attribute, e.g. `iOS 10.1`.",
189189
kind: "Syntax",
190+
traits: ["WithTrailingComma"],
190191
children: [
191192
Child(
192193
name: "AvailabilityVersionRestriction",

CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public let AVAILABILITY_NODES: [Node] = [
2121
nameForDiagnostics: "availability argument",
2222
description: "A single argument to an `@available` argument like `*`, `iOS 10.1`, or `message: \"This has been deprecated\"`.",
2323
kind: "Syntax",
24+
traits: ["WithTrailingComma"],
2425
children: [
2526
Child(
2627
name: "Entry",

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,7 @@ public let DECL_NODES: [Node] = [
17791779
name: "PrecedenceGroupNameElement",
17801780
nameForDiagnostics: nil,
17811781
kind: "Syntax",
1782+
traits: ["WithTrailingComma"],
17821783
children: [
17831784
Child(
17841785
name: "Name",
@@ -2095,6 +2096,7 @@ public let DECL_NODES: [Node] = [
20952096
traits: [
20962097
"IdentifiedDecl",
20972098
"WithAttributes",
2099+
"WithModifiers",
20982100
],
20992101
children: [
21002102
Child(

Sources/SwiftSyntax/generated/SyntaxTraits.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ extension AssociatedtypeDeclSyntax: IdentifiedDeclSyntax, WithAttributesSyntax,
499499

500500
extension AttributedTypeSyntax: WithAttributesSyntax {}
501501

502+
extension AvailabilityArgumentSyntax: WithTrailingCommaSyntax {}
503+
504+
extension AvailabilityVersionRestrictionListEntrySyntax: WithTrailingCommaSyntax {}
505+
502506
extension CaseItemSyntax: WithTrailingCommaSyntax {}
503507

504508
extension CatchClauseSyntax: WithCodeBlockSyntax {}
@@ -603,6 +607,8 @@ extension PoundSourceLocationSyntax: ParenthesizedSyntax {}
603607

604608
extension PrecedenceGroupDeclSyntax: IdentifiedDeclSyntax, WithAttributesSyntax, WithModifiersSyntax {}
605609

610+
extension PrecedenceGroupNameElementSyntax: WithTrailingCommaSyntax {}
611+
606612
extension PrimaryAssociatedTypeSyntax: WithTrailingCommaSyntax {}
607613

608614
extension ProtocolDeclSyntax: DeclGroupSyntax, IdentifiedDeclSyntax, WithAttributesSyntax, WithModifiersSyntax {}
@@ -635,7 +641,7 @@ extension TupleTypeSyntax: ParenthesizedSyntax {}
635641

636642
extension TypeEffectSpecifiersSyntax: EffectSpecifiersSyntax {}
637643

638-
extension TypealiasDeclSyntax: IdentifiedDeclSyntax, WithAttributesSyntax {}
644+
extension TypealiasDeclSyntax: IdentifiedDeclSyntax, WithAttributesSyntax, WithModifiersSyntax {}
639645

640646
extension VariableDeclSyntax: WithAttributesSyntax, WithModifiersSyntax {}
641647

Sources/SwiftSyntaxBuilder/generated/ResultBuilders.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,10 @@ public struct AvailabilitySpecListBuilder {
419419
/// If declared, this will be called on the partial result from the outermost
420420
/// block statement to produce the final returned result.
421421
public static func buildFinalResult(_ component: Component) -> FinalResult {
422-
return .init(component)
422+
let lastIndex = component.count - 1
423+
return .init(component.enumerated().map { index, source in
424+
return index < lastIndex ? source.ensuringTrailingComma() : source
425+
})
423426
}
424427
}
425428

@@ -499,7 +502,10 @@ public struct AvailabilityVersionRestrictionListBuilder {
499502
/// If declared, this will be called on the partial result from the outermost
500503
/// block statement to produce the final returned result.
501504
public static func buildFinalResult(_ component: Component) -> FinalResult {
502-
return .init(component)
505+
let lastIndex = component.count - 1
506+
return .init(component.enumerated().map { index, source in
507+
return index < lastIndex ? source.ensuringTrailingComma() : source
508+
})
503509
}
504510
}
505511

@@ -3128,7 +3134,10 @@ public struct PrecedenceGroupNameListBuilder {
31283134
/// If declared, this will be called on the partial result from the outermost
31293135
/// block statement to produce the final returned result.
31303136
public static func buildFinalResult(_ component: Component) -> FinalResult {
3131-
return .init(component)
3137+
let lastIndex = component.count - 1
3138+
return .init(component.enumerated().map { index, source in
3139+
return index < lastIndex ? source.ensuringTrailingComma() : source
3140+
})
31323141
}
31333142
}
31343143

Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ final class MacroSystemTests: XCTestCase {
11121112
expandedSource: #"""
11131113
struct S {
11141114
@attr static var value1 = 1
1115-
@attr typealias A = B
1115+
@attr static typealias A = B
11161116
}
11171117
"""#,
11181118
macros: ["decls": DeclsFromStringsMacro.self],

0 commit comments

Comments
 (0)