601.0.0
New APIs
-
SameTypeRequirementSyntaxhas a newRightTypenested type.- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
ExprSyntaxor aTypeSyntax. - Pull Request: #2859
- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
-
SameTypeRequirementSyntaxhas a newLeftTypenested type.- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
ExprSyntaxor aTypeSyntax. - Pull Request: #2859
- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
-
GenericArgumentSynaxhas a newArgumentnested type.- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
ExprSyntaxor aTypeSyntax. - Pull Request: #2859
- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
-
GenericParameterSyntaxnow has a newspecifierproperty.- Description: With the introduction of value generics, generic parameters can now be optionally preceded by either a
letor aneach. Thespecifierproperty captures the token representing which one was parsed. - Pull Request: #2785
- Description: With the introduction of value generics, generic parameters can now be optionally preceded by either a
-
IntegerLiteralExprSyntaxandFloatLiteralExprSyntaxnow have a computedrepresentedLiteralValueproperty. -
SyntaxProtocolnow has a methodancestorOrSelf.- Description: Returns the node or the first ancestor that satisfies
condition. - Pull Request: #2696
- Description: Returns the node or the first ancestor that satisfies
-
Errorprotocol now has anasDiagnostics(at:)method.- Description: This method translates an error into one or more diagnostics, recognizing
DiagnosticsErrorandDiagnosticMessageinstances or providing its ownDiagnosticas needed. - Pull Request: #1816
- Description: This method translates an error into one or more diagnostics, recognizing
-
Added a new library
SwiftIfConfig.- Description: This new library provides facilities for evaluating
#ifconditions and determining which regions of a syntax tree are active according to a given build configuration. - Pull Request: #1816
- Description: This new library provides facilities for evaluating
-
SwiftBasicFormatadds a methodindented(by:)to all syntax node types.- Description: This method indents a node’s contents using a provided piece of
Trivia, optionally including the first line. - Pull Request: #2843
- Description: This method indents a node’s contents using a provided piece of
-
Parser.ExperimentalFeatureshas a newinit?(name: String)initializer.- Description: This initializer returns the
Parser.ExperimentalFeaturesvalue that matches the experimental parser feature with the given name. The name must be spelled the same way as it is when passed to the compiler using the-enable-experimental-featureflag. - Pull Request: #2895
- Description: This initializer returns the
API Behavior Changes
SyntaxProtocol.trimmeddetaches the node- Description: Getting a trimmed version of a node detaches it from its parent. Having the trimmed node be attached to a parent was not intuitive because eg. printing the parent node would have the trimmed trivia missing, most likely forming invalid Swift code.
- Pull Request: #2689
Deprecations
-
GenericParameterSyntaxdeprecatedeachKeywordin favor ofspecifier- Description:
specifieris now used to grab either theeachkeyword for a generic parameter or theletkeyword. - Pull request: #2785
- Description:
-
IncrementalEditdeprecated in favor ofSourceEdit -
ClosureCaptureSyntax.init(leadingTrivia:specifier:name:equal:expression:trailingComma:trailingTrivia:)deprecated in favor of a newClosureCaptureSyntax.init(leadingTrivia:_:specifier:_:name:_:initializer:_:trailingComma:_:trailingTrivia:)initializer.- Description:
ClosureCaptureSyntaxnow has aninitializerproperty instead ofequalandexpression. Additionally, thenameproperty is no longer optional. - Pull request: #2763
- Description:
-
IndenterinSwiftSyntaxBuilderhas been deprecated in favor of the newindented(by:)inSwiftBasicFormat.- Description: Indenting is really more of a formatting operation than a syntax-building operation. Additionally, the
indented(by:)method is more intuitive to use than aSyntaxRewriter. Aside fromBasicFormat, there are no other publicSyntaxRewriterclasses in the package. - Pull Request: #2843
- Description: Indenting is really more of a formatting operation than a syntax-building operation. Additionally, the
API-Incompatible Changes
-
SameTypeRequirementSyntax.rightTypehas changed types fromTypeSyntaxtoSameTypeRequirementSyntax.RightType- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
ExprSyntaxor aTypeSyntax. - Pull Request: #2859
- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
-
SameTypeRequirementSyntax.leftTypehas changed types fromTypeSyntaxtoSameTypeRequirementSyntax.LeftType- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
ExprSyntaxor aTypeSyntax. - Pull Request: #2859
- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
-
GenericArgumentSyntax.argumenthas changed types fromTypeSyntaxtoGenericArgumentSyntax.Argument- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
ExprSyntaxor aTypeSyntax. - Pull Request: #2859
- Description: The Swift parser can now parse values as types in certain situations, so the new type reflects the possibility of the argument being either an
-
Moved
RadixandIntegerLiteralExprSyntax.radixfromSwiftRefactortoSwiftSyntax. -
FixIt.Changegained a new casereplaceChild(data:). -
ClosureCaptureSyntax.nameis no longer optional.- Description: Due to the new
ClosureCaptureSyntaxnode structure,nameproperty is non-optional. - Pull request: #2763
- Description: Due to the new