diff --git a/Examples/Sources/MacroExamples/Implementation/ComplexMacros/DictionaryIndirectionMacro.swift b/Examples/Sources/MacroExamples/Implementation/ComplexMacros/DictionaryIndirectionMacro.swift index ccd3651394e..0ec81d4898b 100644 --- a/Examples/Sources/MacroExamples/Implementation/ComplexMacros/DictionaryIndirectionMacro.swift +++ b/Examples/Sources/MacroExamples/Implementation/ComplexMacros/DictionaryIndirectionMacro.swift @@ -19,6 +19,7 @@ extension DictionaryStorageMacro: MemberMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: some DeclGroupSyntax, + conformingTo: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { return ["\n var _storage: [String: Any] = [:]"] diff --git a/Examples/Sources/MacroExamples/Implementation/ComplexMacros/ObservableMacro.swift b/Examples/Sources/MacroExamples/Implementation/ComplexMacros/ObservableMacro.swift index ec4669f5abe..e3e47f85fc0 100644 --- a/Examples/Sources/MacroExamples/Implementation/ComplexMacros/ObservableMacro.swift +++ b/Examples/Sources/MacroExamples/Implementation/ComplexMacros/ObservableMacro.swift @@ -35,6 +35,7 @@ public struct ObservableMacro: MemberMacro, MemberAttributeMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: some DeclGroupSyntax, + conformingTo: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { guard let identified = declaration.asProtocol(NamedDeclSyntax.self) else { diff --git a/Examples/Sources/MacroExamples/Implementation/ComplexMacros/OptionSetMacro.swift b/Examples/Sources/MacroExamples/Implementation/ComplexMacros/OptionSetMacro.swift index 31fad649bb4..2d1706c9114 100644 --- a/Examples/Sources/MacroExamples/Implementation/ComplexMacros/OptionSetMacro.swift +++ b/Examples/Sources/MacroExamples/Implementation/ComplexMacros/OptionSetMacro.swift @@ -177,6 +177,7 @@ extension OptionSetMacro: MemberMacro { public static func expansion( of attribute: AttributeSyntax, providingMembersOf decl: some DeclGroupSyntax, + conformingTo: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { // Decode the expansion arguments. diff --git a/Examples/Sources/MacroExamples/Implementation/Member/CaseDetectionMacro.swift b/Examples/Sources/MacroExamples/Implementation/Member/CaseDetectionMacro.swift index 4e9e184e943..7ad79129c56 100644 --- a/Examples/Sources/MacroExamples/Implementation/Member/CaseDetectionMacro.swift +++ b/Examples/Sources/MacroExamples/Implementation/Member/CaseDetectionMacro.swift @@ -17,6 +17,7 @@ public enum CaseDetectionMacro: MemberMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: some DeclGroupSyntax, + conformingTo: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { declaration.memberBlock.members diff --git a/Examples/Sources/MacroExamples/Implementation/Member/CustomCodable.swift b/Examples/Sources/MacroExamples/Implementation/Member/CustomCodable.swift index d7410da7398..9453cb104b2 100644 --- a/Examples/Sources/MacroExamples/Implementation/Member/CustomCodable.swift +++ b/Examples/Sources/MacroExamples/Implementation/Member/CustomCodable.swift @@ -17,6 +17,7 @@ public enum CustomCodable: MemberMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: some DeclGroupSyntax, + conformingTo: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { let memberList = declaration.memberBlock.members diff --git a/Examples/Sources/MacroExamples/Implementation/Member/MetaEnumMacro.swift b/Examples/Sources/MacroExamples/Implementation/Member/MetaEnumMacro.swift index 4120d050b07..af65ab35148 100644 --- a/Examples/Sources/MacroExamples/Implementation/Member/MetaEnumMacro.swift +++ b/Examples/Sources/MacroExamples/Implementation/Member/MetaEnumMacro.swift @@ -82,6 +82,7 @@ extension MetaEnumMacro: MemberMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: some DeclGroupSyntax, + conformingTo: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { let macro = try MetaEnumMacro(node: node, declaration: declaration, context: context) diff --git a/Examples/Sources/MacroExamples/Implementation/Member/NewTypeMacro.swift b/Examples/Sources/MacroExamples/Implementation/Member/NewTypeMacro.swift index 1740aaf3b3c..50748849877 100644 --- a/Examples/Sources/MacroExamples/Implementation/Member/NewTypeMacro.swift +++ b/Examples/Sources/MacroExamples/Implementation/Member/NewTypeMacro.swift @@ -20,6 +20,7 @@ extension NewTypeMacro: MemberMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: Declaration, + conformingTo: [TypeSyntax], in context: Context ) throws -> [DeclSyntax] where Declaration: DeclGroupSyntax, Context: MacroExpansionContext { do { diff --git a/Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift b/Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift index c9903d9c2f6..88ee393d12f 100644 --- a/Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift +++ b/Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift @@ -326,6 +326,30 @@ extension EffectSpecifiersSyntax { } } +extension GenericArgumentSyntax { + @_disfavoredOverload + @available(*, deprecated, message: "use GenericArgumentSyntax.Argument for 'argument'") + public init( + leadingTrivia: Trivia? = nil, + _ unexpectedBeforeArgument: UnexpectedNodesSyntax? = nil, + argument: some TypeSyntaxProtocol, + _ unexpectedBetweenArgumentAndTrailingComma: UnexpectedNodesSyntax? = nil, + trailingComma: TokenSyntax? = nil, + _ unexpectedAfterTrailingComma: UnexpectedNodesSyntax? = nil, + trailingTrivia: Trivia? = nil + ) { + self.init( + leadingTrivia: leadingTrivia, + unexpectedBeforeArgument, + argument: .type(TypeSyntax(argument)), + unexpectedBetweenArgumentAndTrailingComma, + trailingComma: trailingComma, + unexpectedAfterTrailingComma, + trailingTrivia: trailingTrivia + ) + } +} + extension FunctionEffectSpecifiersSyntax { @_disfavoredOverload @available(*, deprecated, message: "use throwsClause instead of throwsSpecifier") diff --git a/SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/VerifyDocumentation.swift b/SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/VerifyDocumentation.swift index 61874af5563..15efc2fa2fd 100644 --- a/SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/VerifyDocumentation.swift +++ b/SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/VerifyDocumentation.swift @@ -46,11 +46,34 @@ struct VerifyDocumentation: ParsableCommand { } } + func xcodeVersion(xcodebuildExec: URL) throws -> (major: Int, minor: Int) { + let result = try ProcessRunner( + executableURL: xcodebuildExec, + arguments: ["-version"] + ).run(captureStdout: true, captureStderr: false, verbose: false) + let xcodeVersionRegex = Regex { + "Xcode " + Capture(OneOrMore(.digit)) + "." + Capture(OneOrMore(.digit)) + } + guard let match = result.stdout.firstMatch(of: xcodeVersionRegex), let major = Int(match.1), + let minor = Int(match.2) + else { + throw ScriptExectutionError(message: "Failed to extract Xcode version to verify documentation") + } + return (major, minor) + } + func buildDocumentation(product: String) throws { guard let xcodebuildExec = try? Paths.xcodebuildExec else { return } logSection("Building documentation for \(product)") + var otherDoccFlags = ["--warnings-as-errors"] + if try xcodeVersion(xcodebuildExec: xcodebuildExec) >= (16, 0) { + otherDoccFlags.append("--disable-parameters-and-returns-validation") + } try ProcessRunner( executableURL: xcodebuildExec, arguments: [ @@ -60,7 +83,7 @@ struct VerifyDocumentation: ParsableCommand { "-scheme", product, "-destination", "platform=macOS", - "OTHER_DOCC_FLAGS='--warnings-as-errors'", + "OTHER_DOCC_FLAGS=\(otherDoccFlags.joined(separator: " "))", ] ).run(captureStdout: false, captureStderr: false, verbose: self.verbose) }