Skip to content

Fix build failure due to two PRs racing #582

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
Aug 12, 2022
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 Sources/SwiftSyntax/gyb_generated/SyntaxFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public enum SyntaxFactory {
], length: .zero, presence: presence))
return MissingSyntax(data)
}
@available(*, deprecated, message: "Use initializer on MissingDeclSyntax")
public static func makeMissingDecl(_ garbageBeforeAttributes: GarbageNodesSyntax? = nil, attributes: AttributeListSyntax?, _ garbageBetweenAttributesAndModifiers: GarbageNodesSyntax? = nil, modifiers: ModifierListSyntax?) -> MissingDeclSyntax {
let layout: [RawSyntax?] = [
garbageBeforeAttributes?.raw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,16 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
}

public init(
_ garbageBeforeAttributes: GarbageNodesSyntax? = nil,
attributes: AttributeListSyntax?,
_ garbageBetweenAttributesAndModifiers: GarbageNodesSyntax? = nil,
modifiers: ModifierListSyntax?
) {
let layout: [RawSyntax?] = [
garbageBeforeAttributes?.raw,
attributes?.raw,
garbageBetweenAttributesAndModifiers?.raw,
modifiers?.raw,
]
let raw = RawSyntax.createAndCalcLength(kind: SyntaxKind.missingDecl,
layout: layout, presence: SourcePresence.present)
Expand Down
5 changes: 4 additions & 1 deletion Tests/SwiftSyntaxTest/SyntaxChildrenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public class SyntaxChildrenTests: XCTestCase {
}

public func testMissingNodes() throws {
let node = DeclarationStmtSyntax(declaration: DeclSyntax(MissingDeclSyntax()))
let node = DeclarationStmtSyntax(declaration: DeclSyntax(MissingDeclSyntax(
attributes: nil,
modifiers: nil
)))

var sourceAccurateIt = node.children(viewMode: .sourceAccurate).makeIterator()
XCTAssertNextIsNil(&sourceAccurateIt)
Expand Down
5 changes: 4 additions & 1 deletion Tests/SwiftSyntaxTest/VisitorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import SwiftSyntax

public class VisitorTests: XCTestCase {
public func testVisitMissingNodes() throws {
let node = DeclarationStmtSyntax(declaration: DeclSyntax(MissingDeclSyntax()))
let node = DeclarationStmtSyntax(declaration: DeclSyntax(MissingDeclSyntax(
attributes: nil,
modifiers: nil
)))

class MissingDeclChecker: SyntaxVisitor {
var didSeeMissingDeclSyntax = false
Expand Down