diff --git a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift index d3875576887..9bd9c760f8f 100644 --- a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift @@ -333,7 +333,6 @@ public let COMMON_NODES: [Node] = [ Node( kind: .moduleSelector, base: .syntax, - experimentalFeature: .moduleSelector, nameForDiagnostics: "module selector", children: [ Child( diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift index 3ae3005bfce..50daee24036 100644 --- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift @@ -1559,7 +1559,6 @@ public let DECL_NODES: [Node] = [ Child( name: "moduleSelector", kind: .node(kind: .moduleSelector), - experimentalFeature: .moduleSelector, isOptional: true ), Child( @@ -1600,12 +1599,15 @@ public let DECL_NODES: [Node] = [ ), ], childHistory: [ + [ + "moduleSelector": .introduced + ], [ "pound": .renamed(from: "poundToken"), "macroName": .renamed(from: "macro"), "genericArgumentClause": .renamed(from: "genericArguments"), "arguments": .renamed(from: "argumentList"), - ] + ], ] ), diff --git a/CodeGeneration/Sources/SyntaxSupport/ExperimentalFeatures.swift b/CodeGeneration/Sources/SyntaxSupport/ExperimentalFeatures.swift index 690792dad47..e6c5a0304ba 100644 --- a/CodeGeneration/Sources/SyntaxSupport/ExperimentalFeatures.swift +++ b/CodeGeneration/Sources/SyntaxSupport/ExperimentalFeatures.swift @@ -22,7 +22,6 @@ public enum ExperimentalFeature: String, CaseIterable { case keypathWithMethodMembers case oldOwnershipOperatorSpellings case defaultIsolationPerFile - case moduleSelector case borrowAndMutateAccessors /// The name of the feature as it is written in the compiler's `Features.def` file. @@ -46,8 +45,6 @@ public enum ExperimentalFeature: String, CaseIterable { return "OldOwnershipOperatorSpellings" case .defaultIsolationPerFile: return "DefaultIsolationPerFile" - case .moduleSelector: - return "ModuleSelector" case .borrowAndMutateAccessors: return "BorrowAndMutateAccessors" } @@ -74,8 +71,6 @@ public enum ExperimentalFeature: String, CaseIterable { return "`_move` and `_borrow` as ownership operators" case .defaultIsolationPerFile: return "set default actor isolation for a file" - case .moduleSelector: - return "Module selector syntax (`ModName::identifier`)" case .borrowAndMutateAccessors: return "borrow and mutate accessors" } diff --git a/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift b/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift index 206f5fded9b..4920cc7af98 100644 --- a/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift @@ -1005,7 +1005,6 @@ public let EXPR_NODES: [Node] = [ Child( name: "moduleSelector", kind: .node(kind: .moduleSelector), - experimentalFeature: .moduleSelector, isOptional: true ), Child( @@ -1029,10 +1028,13 @@ public let EXPR_NODES: [Node] = [ ), ], childHistory: [ + [ + "moduleSelector": .introduced + ], [ "baseName": .renamed(from: "identifier"), "argumentNames": .renamed(from: "declNameArguments"), - ] + ], ] ), @@ -1367,7 +1369,6 @@ public let EXPR_NODES: [Node] = [ Child( name: "moduleSelector", kind: .node(kind: .moduleSelector), - experimentalFeature: .moduleSelector, isOptional: true ), Child( @@ -1408,12 +1409,15 @@ public let EXPR_NODES: [Node] = [ ), ], childHistory: [ + [ + "moduleSelector": .introduced + ], [ "pound": .renamed(from: "poundToken"), "macroName": .renamed(from: "macro"), "genericArgumentClause": .renamed(from: "genericArguments"), "arguments": .renamed(from: "argumentList"), - ] + ], ] ), diff --git a/CodeGeneration/Sources/SyntaxSupport/Traits.swift b/CodeGeneration/Sources/SyntaxSupport/Traits.swift index 765a58c21a9..10169c0a096 100644 --- a/CodeGeneration/Sources/SyntaxSupport/Traits.swift +++ b/CodeGeneration/Sources/SyntaxSupport/Traits.swift @@ -95,7 +95,6 @@ public let TRAITS: [Trait] = [ Child( name: "moduleSelector", kind: .node(kind: .moduleSelector), - experimentalFeature: .moduleSelector, isOptional: true ), Child(name: "macroName", kind: .token(choices: [.token(.identifier)])), @@ -107,12 +106,15 @@ public let TRAITS: [Trait] = [ Child(name: "additionalTrailingClosures", kind: .node(kind: .multipleTrailingClosureElementList)), ], childHistory: [ + [ + "moduleSelector": .introduced + ], [ "pound": .renamed(from: "poundToken"), "macroName": .renamed(from: "macro"), "arguments": .renamed(from: "argumentList"), "genericArgumentClause": .renamed(from: "genericArguments"), - ] + ], ] ), Trait( diff --git a/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift b/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift index 0b3dc02c1d5..250450a6e7d 100644 --- a/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift @@ -368,7 +368,6 @@ public let TYPE_NODES: [Node] = [ Child( name: "moduleSelector", kind: .node(kind: .moduleSelector), - experimentalFeature: .moduleSelector, nameForDiagnostics: "module selector", isOptional: true ), @@ -382,6 +381,11 @@ public let TYPE_NODES: [Node] = [ kind: .node(kind: .genericArgumentClause), isOptional: true ), + ], + childHistory: [ + [ + "moduleSelector": .introduced + ] ] ), @@ -521,7 +525,6 @@ public let TYPE_NODES: [Node] = [ Child( name: "moduleSelector", kind: .node(kind: .moduleSelector), - experimentalFeature: .moduleSelector, nameForDiagnostics: "module selector", isOptional: true ), @@ -539,6 +542,11 @@ public let TYPE_NODES: [Node] = [ kind: .node(kind: .genericArgumentClause), isOptional: true ), + ], + childHistory: [ + [ + "moduleSelector": .introduced + ] ] ), diff --git a/Sources/SwiftParser/Lexer/Cursor.swift b/Sources/SwiftParser/Lexer/Cursor.swift index 21471dbb098..d55f6024068 100644 --- a/Sources/SwiftParser/Lexer/Cursor.swift +++ b/Sources/SwiftParser/Lexer/Cursor.swift @@ -990,7 +990,7 @@ extension Lexer.Cursor { private mutating func lexNormalColon() -> Lexer.Result { _ = self.advance() - guard self.experimentalFeatures.contains(.moduleSelector) && self.peek() == ":" else { + guard self.peek() == ":" else { return Lexer.Result(.colon) } diff --git a/Sources/SwiftParser/generated/ExperimentalFeatures.swift b/Sources/SwiftParser/generated/ExperimentalFeatures.swift index 331cd0f4790..938e7d56796 100644 --- a/Sources/SwiftParser/generated/ExperimentalFeatures.swift +++ b/Sources/SwiftParser/generated/ExperimentalFeatures.swift @@ -52,11 +52,8 @@ extension Parser.ExperimentalFeatures { /// Whether to enable the parsing of set default actor isolation for a file. public static let defaultIsolationPerFile = Self (rawValue: 1 << 8) - /// Whether to enable the parsing of Module selector syntax (`ModName::identifier`). - public static let moduleSelector = Self (rawValue: 1 << 9) - /// Whether to enable the parsing of borrow and mutate accessors. - public static let borrowAndMutateAccessors = Self (rawValue: 1 << 10) + public static let borrowAndMutateAccessors = Self (rawValue: 1 << 9) /// Creates a new value representing the experimental feature with the /// given name, or returns nil if the name is not recognized. @@ -80,8 +77,6 @@ extension Parser.ExperimentalFeatures { self = .oldOwnershipOperatorSpellings case "DefaultIsolationPerFile": self = .defaultIsolationPerFile - case "ModuleSelector": - self = .moduleSelector case "BorrowAndMutateAccessors": self = .borrowAndMutateAccessors default: diff --git a/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md b/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md index d155f0bf117..64ce006603e 100644 --- a/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md +++ b/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md @@ -362,6 +362,7 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code. - - - +- - - - diff --git a/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift b/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift index 1bff5115f67..b5245e8feaf 100644 --- a/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift +++ b/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift @@ -1549,12 +1549,10 @@ open class SyntaxAnyVisitor: SyntaxVisitor { visitAnyPost(node._syntaxNode) } - @_spi(ExperimentalLanguageFeatures) override open func visit(_ node: ModuleSelectorSyntax) -> SyntaxVisitorContinueKind { return visitAny(node._syntaxNode) } - @_spi(ExperimentalLanguageFeatures) override open func visitPost(_ node: ModuleSelectorSyntax) { visitAnyPost(node._syntaxNode) } diff --git a/Sources/SwiftSyntax/generated/SyntaxEnum.swift b/Sources/SwiftSyntax/generated/SyntaxEnum.swift index 9c7a96068ff..83e7c87c244 100644 --- a/Sources/SwiftSyntax/generated/SyntaxEnum.swift +++ b/Sources/SwiftSyntax/generated/SyntaxEnum.swift @@ -210,7 +210,6 @@ public enum SyntaxEnum: Sendable { case missingStmt(MissingStmtSyntax) case missing(MissingSyntax) case missingType(MissingTypeSyntax) - @_spi(ExperimentalLanguageFeatures) case moduleSelector(ModuleSelectorSyntax) case multipleTrailingClosureElementList(MultipleTrailingClosureElementListSyntax) case multipleTrailingClosureElement(MultipleTrailingClosureElementSyntax) diff --git a/Sources/SwiftSyntax/generated/SyntaxKind.swift b/Sources/SwiftSyntax/generated/SyntaxKind.swift index b4bfaad0313..51d1448bdd3 100644 --- a/Sources/SwiftSyntax/generated/SyntaxKind.swift +++ b/Sources/SwiftSyntax/generated/SyntaxKind.swift @@ -210,7 +210,6 @@ public enum SyntaxKind: Sendable { case missingStmt case missing case missingType - @_spi(ExperimentalLanguageFeatures) case moduleSelector case multipleTrailingClosureElementList case multipleTrailingClosureElement diff --git a/Sources/SwiftSyntax/generated/SyntaxRewriter.swift b/Sources/SwiftSyntax/generated/SyntaxRewriter.swift index 4edf4a1a1f9..57adc1e1096 100644 --- a/Sources/SwiftSyntax/generated/SyntaxRewriter.swift +++ b/Sources/SwiftSyntax/generated/SyntaxRewriter.swift @@ -1397,10 +1397,9 @@ open class SyntaxRewriter { return TypeSyntax(MissingTypeSyntax(unsafeCasting: visitChildren(node._syntaxNode))) } - /// Visit a `ModuleSelectorSyntax`. + /// Visit a ``ModuleSelectorSyntax``. /// - Parameter node: the node that is being visited /// - Returns: the rewritten node - @_spi(ExperimentalLanguageFeatures) open func visit(_ node: ModuleSelectorSyntax) -> ModuleSelectorSyntax { return ModuleSelectorSyntax(unsafeCasting: visitChildren(node._syntaxNode)) } diff --git a/Sources/SwiftSyntax/generated/SyntaxTraits.swift b/Sources/SwiftSyntax/generated/SyntaxTraits.swift index f982fc26147..670ea0e0dac 100644 --- a/Sources/SwiftSyntax/generated/SyntaxTraits.swift +++ b/Sources/SwiftSyntax/generated/SyntaxTraits.swift @@ -205,7 +205,6 @@ public protocol FreestandingMacroExpansionSyntax: SyntaxProtocol { set } - @_spi(ExperimentalLanguageFeatures) var moduleSelector: ModuleSelectorSyntax? { get set diff --git a/Sources/SwiftSyntax/generated/SyntaxVisitor.swift b/Sources/SwiftSyntax/generated/SyntaxVisitor.swift index 55d8361eeb8..76b2db0d083 100644 --- a/Sources/SwiftSyntax/generated/SyntaxVisitor.swift +++ b/Sources/SwiftSyntax/generated/SyntaxVisitor.swift @@ -2263,17 +2263,15 @@ open class SyntaxVisitor { open func visitPost(_ node: MissingTypeSyntax) { } - /// Visiting `ModuleSelectorSyntax` specifically. + /// Visiting ``ModuleSelectorSyntax`` specifically. /// - Parameter node: the node we are visiting. /// - Returns: how should we continue visiting. - @_spi(ExperimentalLanguageFeatures) open func visit(_ node: ModuleSelectorSyntax) -> SyntaxVisitorContinueKind { return .visitChildren } - /// The function called after visiting `ModuleSelectorSyntax` and its descendants. + /// The function called after visiting ``ModuleSelectorSyntax`` and its descendants. /// - node: the node we just finished visiting. - @_spi(ExperimentalLanguageFeatures) open func visitPost(_ node: ModuleSelectorSyntax) { } diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodesJKLMN.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodesJKLMN.swift index 14aff2265cb..df1142fe80f 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodesJKLMN.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodesJKLMN.swift @@ -2734,7 +2734,6 @@ public struct RawMissingTypeSyntax: RawTypeSyntaxNodeProtocol { } } -@_spi(ExperimentalLanguageFeatures) @_spi(RawSyntax) public struct RawModuleSelectorSyntax: RawSyntaxNodeProtocol { @_spi(RawSyntax) diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift index 7348868196b..235fcba86a2 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift @@ -628,7 +628,7 @@ public struct DeclNameArgumentsSyntax: SyntaxProtocol, SyntaxHashable, _LeafSynt /// ### Children /// -/// - `moduleSelector`: `ModuleSelectorSyntax`? +/// - `moduleSelector`: ``ModuleSelectorSyntax``? /// - `baseName`: (`` | `self` | `Self` | `init` | `deinit` | `subscript` | `` | `` | ``) /// - `argumentNames`: ``DeclNameArgumentsSyntax``? /// @@ -657,7 +657,7 @@ public struct DeclReferenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Leaf /// - Parameters: /// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. /// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. - @_spi(ExperimentalLanguageFeatures) public init( + public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeModuleSelector: UnexpectedNodesSyntax? = nil, moduleSelector: ModuleSelectorSyntax? = nil, @@ -699,7 +699,6 @@ public struct DeclReferenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Leaf } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBeforeModuleSelector: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 0)?.cast(UnexpectedNodesSyntax.self) @@ -709,7 +708,6 @@ public struct DeclReferenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Leaf } } - @_spi(ExperimentalLanguageFeatures) public var moduleSelector: ModuleSelectorSyntax? { get { return Syntax(self).child(at: 1)?.cast(ModuleSelectorSyntax.self) @@ -719,7 +717,6 @@ public struct DeclReferenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Leaf } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenModuleSelectorAndBaseName: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 2)?.cast(UnexpectedNodesSyntax.self) diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift index 3806f606106..f0882c9acf8 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift @@ -1709,7 +1709,7 @@ public struct IdentifierPatternSyntax: PatternSyntaxProtocol, SyntaxHashable, _L /// ### Children /// -/// - `moduleSelector`: `ModuleSelectorSyntax`? +/// - `moduleSelector`: ``ModuleSelectorSyntax``? /// - `name`: (`` | `Self` | `Any` | `_`) /// - `genericArgumentClause`: ``GenericArgumentClauseSyntax``? public struct IdentifierTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSyntaxNodeProtocol { @@ -1730,7 +1730,7 @@ public struct IdentifierTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTyp /// - Parameters: /// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. /// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. - @_spi(ExperimentalLanguageFeatures) public init( + public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeModuleSelector: UnexpectedNodesSyntax? = nil, moduleSelector: ModuleSelectorSyntax? = nil, @@ -1772,7 +1772,6 @@ public struct IdentifierTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTyp } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBeforeModuleSelector: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 0)?.cast(UnexpectedNodesSyntax.self) @@ -1782,7 +1781,6 @@ public struct IdentifierTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTyp } } - @_spi(ExperimentalLanguageFeatures) public var moduleSelector: ModuleSelectorSyntax? { get { return Syntax(self).child(at: 1)?.cast(ModuleSelectorSyntax.self) @@ -1792,7 +1790,6 @@ public struct IdentifierTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTyp } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenModuleSelectorAndName: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 2)?.cast(UnexpectedNodesSyntax.self) diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift index 956844943fc..92bbb9e6f28 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift @@ -2653,7 +2653,7 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable, _LeafDeclSynt /// - `attributes`: ``AttributeListSyntax`` /// - `modifiers`: ``DeclModifierListSyntax`` /// - `pound`: `#` -/// - `moduleSelector`: `ModuleSelectorSyntax`? +/// - `moduleSelector`: ``ModuleSelectorSyntax``? /// - `macroName`: `` /// - `genericArgumentClause`: ``GenericArgumentClauseSyntax``? /// - `leftParen`: `(`? @@ -2680,7 +2680,7 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable, _Lea /// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. /// - pound: The `#` sign. /// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. - @_spi(ExperimentalLanguageFeatures) public init( + public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, attributes: AttributeListSyntax = [], @@ -2883,7 +2883,6 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable, _Lea } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenPoundAndModuleSelector: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 6)?.cast(UnexpectedNodesSyntax.self) @@ -2893,7 +2892,6 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable, _Lea } } - @_spi(ExperimentalLanguageFeatures) public var moduleSelector: ModuleSelectorSyntax? { get { return Syntax(self).child(at: 7)?.cast(ModuleSelectorSyntax.self) @@ -2903,7 +2901,6 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable, _Lea } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenModuleSelectorAndMacroName: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 8)?.cast(UnexpectedNodesSyntax.self) @@ -3136,7 +3133,7 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable, _Lea /// ### Children /// /// - `pound`: `#` -/// - `moduleSelector`: `ModuleSelectorSyntax`? +/// - `moduleSelector`: ``ModuleSelectorSyntax``? /// - `macroName`: `` /// - `genericArgumentClause`: ``GenericArgumentClauseSyntax``? /// - `leftParen`: `(`? @@ -3163,7 +3160,7 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Lea /// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. /// - pound: The `#` sign. /// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. - @_spi(ExperimentalLanguageFeatures) public init( + public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforePound: UnexpectedNodesSyntax? = nil, pound: TokenSyntax = .poundToken(), @@ -3264,7 +3261,6 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Lea } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenPoundAndModuleSelector: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 2)?.cast(UnexpectedNodesSyntax.self) @@ -3274,7 +3270,6 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Lea } } - @_spi(ExperimentalLanguageFeatures) public var moduleSelector: ModuleSelectorSyntax? { get { return Syntax(self).child(at: 3)?.cast(ModuleSelectorSyntax.self) @@ -3284,7 +3279,6 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _Lea } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenModuleSelectorAndMacroName: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 4)?.cast(UnexpectedNodesSyntax.self) @@ -4268,7 +4262,7 @@ public struct MemberBlockSyntax: SyntaxProtocol, SyntaxHashable, _LeafSyntaxNode /// /// - `baseType`: ``TypeSyntax`` /// - `period`: `.` -/// - `moduleSelector`: `ModuleSelectorSyntax`? +/// - `moduleSelector`: ``ModuleSelectorSyntax``? /// - `name`: (`` | `self`) /// - `genericArgumentClause`: ``GenericArgumentClauseSyntax``? public struct MemberTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSyntaxNodeProtocol { @@ -4289,7 +4283,7 @@ public struct MemberTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSyn /// - Parameters: /// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. /// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored. - @_spi(ExperimentalLanguageFeatures) public init( + public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeBaseType: UnexpectedNodesSyntax? = nil, baseType: some TypeSyntaxProtocol, @@ -4382,7 +4376,6 @@ public struct MemberTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSyn } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenPeriodAndModuleSelector: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 4)?.cast(UnexpectedNodesSyntax.self) @@ -4392,7 +4385,6 @@ public struct MemberTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSyn } } - @_spi(ExperimentalLanguageFeatures) public var moduleSelector: ModuleSelectorSyntax? { get { return Syntax(self).child(at: 5)?.cast(ModuleSelectorSyntax.self) @@ -4402,7 +4394,6 @@ public struct MemberTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSyn } } - @_spi(ExperimentalLanguageFeatures) public var unexpectedBetweenModuleSelectorAndName: UnexpectedNodesSyntax? { get { return Syntax(self).child(at: 6)?.cast(UnexpectedNodesSyntax.self) @@ -5257,8 +5248,6 @@ public struct MissingTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSy // MARK: - ModuleSelectorSyntax -/// - Note: Requires experimental feature `moduleSelector`. -/// /// ### Children /// /// - `moduleName`: `` @@ -5271,7 +5260,6 @@ public struct MissingTypeSyntax: TypeSyntaxProtocol, SyntaxHashable, _LeafTypeSy /// - ``MacroExpansionDeclSyntax``.``MacroExpansionDeclSyntax/moduleSelector`` /// - ``MacroExpansionExprSyntax``.``MacroExpansionExprSyntax/moduleSelector`` /// - ``MemberTypeSyntax``.``MemberTypeSyntax/moduleSelector`` -@_spi(ExperimentalLanguageFeatures) public struct ModuleSelectorSyntax: SyntaxProtocol, SyntaxHashable, _LeafSyntaxNodeProtocol { public let _syntaxNode: Syntax diff --git a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift index 5469a229908..22a143f7258 100644 --- a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift +++ b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift @@ -1043,7 +1043,7 @@ extension KeyPathSubscriptComponentSyntax { extension MacroExpansionDeclSyntax { /// A convenience initializer that allows initializing syntax collections using result builders - @_spi(ExperimentalLanguageFeatures) public init( + public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, attributes: AttributeListSyntax = [], @@ -1102,7 +1102,7 @@ extension MacroExpansionDeclSyntax { extension MacroExpansionExprSyntax { /// A convenience initializer that allows initializing syntax collections using result builders - @_spi(ExperimentalLanguageFeatures) public init( + public init( leadingTrivia: Trivia? = nil, unexpectedBeforePound: UnexpectedNodesSyntax? = nil, pound: TokenSyntax = .poundToken(), diff --git a/Tests/SwiftParserTest/AttributeTests.swift b/Tests/SwiftParserTest/AttributeTests.swift index 1a9f72712b4..3193a750ccf 100644 --- a/Tests/SwiftParserTest/AttributeTests.swift +++ b/Tests/SwiftParserTest/AttributeTests.swift @@ -193,18 +193,6 @@ final class AttributeTests: ParserTestCase { """ ) - // Same as above, but with module selectors, which introduce a token for adjacent colons. - assertParse( - """ - @objc(zeroArg) - class A { } - - @objc(:::x::) - func f(_: Int, _: Int, _: Int, _: Int, _: Int) { } - """, - experimentalFeatures: [.moduleSelector] - ) - assertParse( """ @objc(_:) diff --git a/Tests/SwiftParserTest/LexerTests.swift b/Tests/SwiftParserTest/LexerTests.swift index 7d9cc753ece..16ffd75a5a8 100644 --- a/Tests/SwiftParserTest/LexerTests.swift +++ b/Tests/SwiftParserTest/LexerTests.swift @@ -587,8 +587,7 @@ class LexerTests: ParserTestCase { LexemeSpec(.colonColon, text: "::"), LexemeSpec(.binaryOperator, text: "/"), LexemeSpec(.rightParen, text: ")"), - ], - experimentalFeatures: [.moduleSelector] + ] ) } @@ -852,8 +851,7 @@ class LexerTests: ParserTestCase { LexemeSpec(.identifier, text: "Foo"), LexemeSpec(.colonColon, text: "::"), LexemeSpec(.identifier, text: "bar"), - ], - experimentalFeatures: [.moduleSelector] + ] ) assertLexemes( @@ -862,8 +860,7 @@ class LexerTests: ParserTestCase { LexemeSpec(.identifier, text: "Foo", trailing: " "), LexemeSpec(.colonColon, text: "::"), LexemeSpec(.identifier, text: "bar"), - ], - experimentalFeatures: [.moduleSelector] + ] ) assertLexemes( @@ -872,8 +869,7 @@ class LexerTests: ParserTestCase { LexemeSpec(.identifier, text: "Foo"), LexemeSpec(.colonColon, text: "::", trailing: " "), LexemeSpec(.identifier, text: "bar"), - ], - experimentalFeatures: [.moduleSelector] + ] ) assertLexemes( @@ -882,8 +878,7 @@ class LexerTests: ParserTestCase { LexemeSpec(.identifier, text: "Foo", trailing: " "), LexemeSpec(.colonColon, text: "::", trailing: " "), LexemeSpec(.identifier, text: "bar"), - ], - experimentalFeatures: [.moduleSelector] + ] ) assertLexemes( @@ -893,18 +888,6 @@ class LexerTests: ParserTestCase { LexemeSpec(.colon, text: ":", trailing: " "), LexemeSpec(.colon, text: ":"), LexemeSpec(.identifier, text: "bar"), - ], - experimentalFeatures: [.moduleSelector] - ) - - // Only produce the new token when the experimental feature is enabled. - assertLexemes( - "Foo::bar", - lexemes: [ - LexemeSpec(.identifier, text: "Foo"), - LexemeSpec(.colon, text: ":"), - LexemeSpec(.colon, text: ":"), - LexemeSpec(.identifier, text: "bar"), ] ) } diff --git a/Tests/SwiftParserTest/translated/ModuleSelectorTests.swift b/Tests/SwiftParserTest/translated/ModuleSelectorTests.swift index 5479ed1ea06..1f2114b0ca8 100644 --- a/Tests/SwiftParserTest/translated/ModuleSelectorTests.swift +++ b/Tests/SwiftParserTest/translated/ModuleSelectorTests.swift @@ -17,10 +17,6 @@ import XCTest final class ModuleSelectorTests: ParserTestCase { - override var experimentalFeatures: Parser.ExperimentalFeatures { - [.moduleSelector] - } - func testModuleSelectorImports() { assertParse( """ @@ -1798,7 +1794,7 @@ final class ModuleSelectorTests: ParserTestCase { CodeBlockItemSyntax(item: .expr(ExprSyntax(IntegerLiteralExprSyntax(integerLiteral: 1)))) } ), - experimentalFeatures: [.moduleSelector, .doExpressions] + experimentalFeatures: [.doExpressions] ) assertParse( """ @@ -1812,7 +1808,7 @@ final class ModuleSelectorTests: ParserTestCase { let x = Swift::<#identifier#> do { 1 } """, - experimentalFeatures: [.moduleSelector, .doExpressions] + experimentalFeatures: [.doExpressions] ) assertParse( "let x = Swift::if1️⃣ y { 1 } 2️⃣else { 0 }",