Skip to content

Commit 484dd99

Browse files
committed
Enable some Swift 7 mode features
1 parent 9c77951 commit 484dd99

File tree

100 files changed

+212
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+212
-159
lines changed

Package.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,25 @@ var targets: [Target] = [
125125
),
126126
]
127127

128+
// Apply global Swift settings to targets.
129+
do {
130+
let globalSwiftSettings: [SwiftSetting] = [
131+
// Swift 7 mode upcoming features. These must be compatible with 'swift-tools-version'.
132+
.enableUpcomingFeature("InternalImportsByDefault"),
133+
.enableUpcomingFeature("MemberImportVisibility"),
134+
.enableUpcomingFeature("NonisolatedNonsendingByDefault"),
135+
]
136+
137+
for target in targets where target.type != .plugin {
138+
if let swiftSettings = target.swiftSettings {
139+
// Target-specific settings should come last.
140+
target.swiftSettings = globalSwiftSettings + swiftSettings
141+
} else {
142+
target.swiftSettings = globalSwiftSettings
143+
}
144+
}
145+
}
146+
128147
if buildOnlyTests {
129148
products = []
130149
let allowedNames: Set<String> = ["_SwiftFormatTestSupport", "_GenerateSwiftFormat"]

Sources/SwiftFormat/API/Configuration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
13+
public import Foundation
1414

1515
/// A version number that can be specified in the configuration file, which allows us to change the
1616
/// format in the future if desired and still support older files.

Sources/SwiftFormat/API/Selection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Foundation
14-
import SwiftSyntax
14+
public import SwiftSyntax
1515

1616
/// The selection as given on the command line - an array of offets and lengths
1717
public enum Selection: Sendable {

Sources/SwiftFormat/API/SwiftFormatError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
13+
public import Foundation
1414
import SwiftSyntax
1515

1616
/// Errors that can be thrown by the `SwiftFormatter` and `SwiftLinter` APIs.

Sources/SwiftFormat/API/SwiftFormatter.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
14-
import SwiftDiagnostics
15-
import SwiftOperators
16-
import SwiftSyntax
13+
public import Foundation
14+
public import SwiftDiagnostics
15+
public import SwiftOperators
16+
public import SwiftSyntax
1717

1818
/// Formats Swift source code or syntax trees according to the Swift style guidelines.
1919
public final class SwiftFormatter {

Sources/SwiftFormat/API/SwiftLinter.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
14-
import SwiftDiagnostics
15-
import SwiftOperators
16-
import SwiftSyntax
13+
public import Foundation
14+
public import SwiftDiagnostics
15+
public import SwiftOperators
16+
public import SwiftSyntax
1717

1818
/// Diagnoses and reports problems in Swift source code or syntax trees according to the Swift style
1919
/// guidelines.

Sources/SwiftFormat/Core/Context.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
14-
import SwiftOperators
13+
public import Foundation
14+
public import SwiftOperators
1515
import SwiftParser
16-
import SwiftSyntax
16+
public import SwiftSyntax
1717

1818
/// Context contains the bits that each formatter and linter will need access to.
1919
///

Sources/SwiftFormat/Core/DocumentationComment.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Markdown
14-
import SwiftSyntax
13+
import Foundation
14+
public import Markdown
15+
public import SwiftSyntax
1516

1617
/// A structured representation of information extracted from a documentation comment.
1718
///

Sources/SwiftFormat/Core/DocumentationCommentText.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import SwiftSyntax
13+
public import SwiftSyntax
1414

1515
/// The text contents of a documentation comment extracted from trivia.
1616
///

Sources/SwiftFormat/Core/ImportsXCTestVisitor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import SwiftSyntax
13+
public import SwiftSyntax
1414

1515
/// A visitor that determines if the target source file imports `XCTest`.
1616
private class ImportsXCTestVisitor: SyntaxVisitor {

0 commit comments

Comments
 (0)