Skip to content

Enable API breakage, unacceptable language and yamllint CI checks #2995

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 3 commits into from
Mar 7, 2025
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
68 changes: 34 additions & 34 deletions .github/ISSUE_TEMPLATE/BASICFORMAT_BUG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@ name: BasicFormat Bug
description: A bug in the BasicFormat module
labels: [bug, BasicFormat]
body:
- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report! We would really appreciate if you could take the time to reduce the issue as described in [Filing BasicFormat Bug Reports](https://swiftpackageindex.com/swiftlang/swift-syntax/main/documentation/swiftbasicformat/filingbugreports).
- type: textarea
id: source
attributes:
label: Source Code
description: The source code that, when formatted, produces incorrectly formatted code.
value: |
```swift
```
- type: textarea
id: source
attributes:
label: Actual Formatted Code
description: The way that `BasicFormat` formats the above code
value: |
```swift
```
- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report! We would really appreciate if you could take the time to reduce the issue as described in [Filing BasicFormat Bug Reports](https://swiftpackageindex.com/swiftlang/swift-syntax/main/documentation/swiftbasicformat/filingbugreports).
- type: textarea
id: source
attributes:
label: Expected Formatted Code
description: The way that you think `BasicFormat` should format the code
value: |
```swift
```
- type: textarea
id: description
attributes:
label: Description
description: |
Any additional information you can provide for this issue, like
- Has this issue started occurring recently?
- Is the issue only happening under certain circumstances?
id: source
attributes:
label: Source Code
description: The source code that, when formatted, produces incorrectly formatted code.
value: |
```swift
```
- type: textarea
id: source
attributes:
label: Actual Formatted Code
description: The way that `BasicFormat` formats the above code
value: |
```swift
```
- type: textarea
id: source
attributes:
label: Expected Formatted Code
description: The way that you think `BasicFormat` should format the code
value: |
```swift
```
- type: textarea
id: description
attributes:
label: Description
description: |
Any additional information you can provide for this issue, like
- Has this issue started occurring recently?
- Is the issue only happening under certain circumstances?
28 changes: 14 additions & 14 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Bug Report
description: Something isn't working as expected
labels: [bug]
body:
- type: textarea
id: description
attributes:
label: Description
description: |
A short description of the incorrect behavior.
If you think this issue has been recently introduced and did not occur in an
earlier version, please note that. If possible, include the last version that
the behavior was correct in addition to your current version.
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to Reproduce
description: Replace this paragraph with an explanation of how to reproduce the incorrect behavior.
- type: textarea
id: description
attributes:
label: Description
description: |
A short description of the incorrect behavior.
If you think this issue has been recently introduced and did not occur in an
earlier version, please note that. If possible, include the last version that
the behavior was correct in addition to your current version.
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to Reproduce
description: Replace this paragraph with an explanation of how to reproduce the incorrect behavior.
18 changes: 9 additions & 9 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Feature Request
description: A suggestion for a new feature
labels: [enhancement]
body:
- type: textarea
id: description
attributes:
label: Description
description: |
A description of your proposed feature.
Examples that show what's missing, or what new capabilities will be possible, are very helpful!
If this feature unlocks new use-cases please describe them.
Provide links to existing issues or external references/discussions, if appropriate.
- type: textarea
id: description
attributes:
label: Description
description: |
A description of your proposed feature.
Examples that show what's missing, or what new capabilities will be possible, are very helpful!
If this feature unlocks new use-cases please describe them.
Provide links to existing issues or external references/discussions, if appropriate.
66 changes: 33 additions & 33 deletions .github/ISSUE_TEMPLATE/PARSER_BUG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@ name: SwiftParser Bug
description: A bug in the new Swift parser
labels: [bug, SwiftParser]
body:
- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report! We would really appreciate if you could take the time to reduce the issue as described in [Filing Parser Bug Reports](https://swiftpackageindex.com/swiftlang/swift-syntax/main/documentation/swiftparser/filingbugreports).
- type: dropdown
id: issue-type
attributes:
label: Issue Kind
description: What kind of issue is this? See [Filing Parser Bug Reports](https://swiftpackageindex.com/swiftlang/swift-syntax/main/documentation/swiftparser/filingbugreports) for more details.
options:
- Round-Trip Failure
- Parser Crash
- Parse of Valid Source Failed
- Parse of Valid Source Produced Invalid Syntax Tree
- Bad Diagnostic Produced
- Other
- I Don’t Know
- type: textarea
id: source
attributes:
label: Source Code
description: The source code that, when fed into the parser, produces the bug.
value: |
```swift
```
- type: textarea
id: description
attributes:
label: Description
description: |
Any additional information you can provide for this issue, like
- What did you expect to happen?
- Has this issue started occurring recently?
- If it’s a crash, the stack trace.
- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report! We would really appreciate if you could take the time to reduce the issue as described in [Filing Parser Bug Reports](https://swiftpackageindex.com/swiftlang/swift-syntax/main/documentation/swiftparser/filingbugreports).
- type: dropdown
id: issue-type
attributes:
label: Issue Kind
description: What kind of issue is this? See [Filing Parser Bug Reports](https://swiftpackageindex.com/swiftlang/swift-syntax/main/documentation/swiftparser/filingbugreports) for more details.
options:
- Round-Trip Failure
- Parser Crash
- Parse of Valid Source Failed
- Parse of Valid Source Produced Invalid Syntax Tree
- Bad Diagnostic Produced
- Other
- I Don’t Know
- type: textarea
id: source
attributes:
label: Source Code
description: The source code that, when fed into the parser, produces the bug.
value: |
```swift
```
- type: textarea
id: description
attributes:
label: Description
description: |
Any additional information you can provide for this issue, like
- What did you expect to happen?
- Has this issue started occurring recently?
- If it’s a crash, the stack trace.
26 changes: 13 additions & 13 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2022 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
#
# Copyright (c) 2022 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors

contact_links:
- name: Discussion Forum
url: https://forums.swift.org/tags/c/development/tooling/39/swift-syntax
about: Ask and answer questions about SwiftSyntax
- name: SwiftSyntax Documentation
url: https://swiftpackageindex.com/swiftlang/swift-syntax/documentation/swiftsyntax
about: Learn about how to use the SwiftSyntax in your projects
contact_links:
- name: Discussion Forum
url: https://forums.swift.org/tags/c/development/tooling/39/swift-syntax
about: Ask and answer questions about SwiftSyntax
- name: SwiftSyntax Documentation
url: https://swiftpackageindex.com/swiftlang/swift-syntax/documentation/swiftsyntax
about: Learn about how to use the SwiftSyntax in your projects
7 changes: 1 addition & 6 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ jobs:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
# https://github.com/swiftlang/swift-syntax/issues/2986
api_breakage_check_enabled: false
api_breakage_check_allowlist_path: "Release Notes/api-breakages.txt"
# https://github.com/swiftlang/swift-syntax/issues/2987
docs_check_enabled: false
# https://github.com/swiftlang/swift-syntax/issues/2988
format_check_enabled: false
# https://github.com/swiftlang/swift-syntax/issues/2990
unacceptable_language_check_enabled: false
# https://github.com/swiftlang/swift-syntax/issues/2991
yamllint_check_enabled: false
36 changes: 18 additions & 18 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# This is manifest file for the Swift Package Index for it to
# This is manifest file for the Swift Package Index for it to
# auto-generate and host DocC documentation.
# For reference see https://swiftpackageindex.com/swiftpackageindex/spimanifest/documentation/spimanifest/commonusecases#Host-DocC-documentation-in-the-Swift-Package-Index.

version: 1
builder:
configs:
- documentation_targets:
# First item in the list is the "landing" (default) target
- SwiftSyntax
- SwiftBasicFormat
- SwiftCompilerPlugin
- SwiftDiagnostics
- SwiftIDEUtils
- SwiftIfConfig
- SwiftLexicalLookup
- SwiftOperators
- SwiftParser
- SwiftParserDiagnostics
- SwiftRefactor
- SwiftSyntaxBuilder
- SwiftSyntaxMacros
- SwiftSyntaxMacroExpansion
- SwiftSyntaxMacrosGenericTestSupport
- SwiftSyntaxMacrosTestSupport
# First item in the list is the "landing" (default) target
- SwiftSyntax
- SwiftBasicFormat
- SwiftCompilerPlugin
- SwiftDiagnostics
- SwiftIDEUtils
- SwiftIfConfig
- SwiftLexicalLookup
- SwiftOperators
- SwiftParser
- SwiftParserDiagnostics
- SwiftRefactor
- SwiftSyntaxBuilder
- SwiftSyntaxMacros
- SwiftSyntaxMacroExpansion
- SwiftSyntaxMacrosGenericTestSupport
- SwiftSyntaxMacrosTestSupport
custom_documentation_parameters: [--experimental-skip-synthesized-symbols]
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
/// These methods enable casting between syntax node types within the same
/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``).
///
/// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
/// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't
/// appropriate for use on types conforming to a specific base node protocol
/// like ``\#(node.kind.protocolType)``. That's because at this level,
Expand All @@ -51,7 +51,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
///
/// To guide developers toward correct usage, this extension provides overloads
/// of these casting methods that are restricted to the same base node type.
/// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
/// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
/// deprecated, indicating that they will always fail when used in this context.
extension \#(node.kind.protocolType) {
/// Checks if the current syntax node can be cast to a given specialized syntax type.
Expand Down Expand Up @@ -184,9 +184,8 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
"""
/// Create a \(raw: node.kind.doccLink) node from a specialized syntax node.
public init(_ syntax: __shared some \(node.kind.protocolType)) {
// We know this cast is going to succeed. Go through init(_: SyntaxData)
// to do a sanity check and verify the kind matches in debug builds and get
// maximum performance in release builds.
// We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
// verify the kind matches in debug builds and get maximum performance in release builds.
self = Syntax(syntax).cast(Self.self)
}
"""
Expand All @@ -205,9 +204,8 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
DeclSyntax(
"""
public init(fromProtocol syntax: __shared \(node.kind.protocolType)) {
// We know this cast is going to succeed. Go through init(_: SyntaxData)
// to do a sanity check and verify the kind matches in debug builds and get
// maximum performance in release builds.
// We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
// verify the kind matches in debug builds and get maximum performance in release builds.
self = Syntax(syntax).cast(Self.self)
}
"""
Expand Down
5 changes: 5 additions & 0 deletions Contributor Documentation/API Breakage Checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# API Breakage Checks

We have a CI jobs that checks for API breakages. Since swift-syntax releases increase the major version number, it is possible to make API-breaking changes – but we should avoid them whenever possible to avoid churn on clients when they update to a new swift-syntax version.

If your change contains an API breaking change, add the change to `api-breakages.txt`. All API breaking changes should be accompanied by an [RFC](RFC%20Process.md).
1 change: 1 addition & 0 deletions Contributor Documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

The following documentation documents are primarily intended for developers of swift-syntax.

- [API Breakage Checks](API%20Breakage%20Checks.md)
- [Changing Swift Syntax](Changing%20Swift%20Syntax.md)
- [Filing Parser Bug Reports](Filing%20Parser%20Bug%20Reports.md)
- [Fixing Bugs](Fixing%20Bugs.md)
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftParser/Expressions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ extension Parser {
) -> RawExprSyntax {
// Try parse a single value statement as an expression (e.g do/if/switch).
// Note we do this here in parseUnaryExpression as we don't allow postfix
// syntax to hang off such expressions to avoid ambiguities such as postfix
// syntax to be attached to such expressions to avoid ambiguities such as postfix
// '.member', which can currently be parsed as a static dot member for a
// result builder.
switch self.at(anyIn: SingleValueStatementExpression.self) {
Expand Down
Loading