Skip to content

Commit 1d1aded

Browse files
committed
Use access levels on imports when compiler(>=6).
Access levels on `import` declarations are a language feature that was introduced with the Swift 6 compiler but they don't depend on the Swift 6 language mode. `@_implementationOnly import` is now deprecated and `internal import` should be used instead, so SwiftSyntax's use of access levels on imports should depend on the compiler version, not the language version to ensure it no longer uses the `@_implementationOnly` unnecessarily. As a notable exception, `_SwiftSyntaxCShims` must continue to be imported `@_implementationOnly` since it's a local module that cannot be loaded by clients, and `internal import` does not hide modules from dependents when SwiftSyntax is built without library evolution.
1 parent ff4f384 commit 1d1aded

File tree

164 files changed

+168
-168
lines changed

Some content is hidden

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

164 files changed

+168
-168
lines changed

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparser/IsLexerClassifiedFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let isLexerClassifiedFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
public import SwiftSyntax
2323
#else
2424
import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparser/LayoutNodesParsableFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let layoutNodesParsableFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
@_spi(RawSyntax) public import SwiftSyntax
2323
#else
2424
@_spi(RawSyntax) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparser/ParserTokenSpecSetFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func tokenCaseMatch(
2929
let parserTokenSpecSetFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
3030
DeclSyntax(
3131
"""
32-
#if swift(>=6)
32+
#if compiler(>=6)
3333
@_spi(RawSyntax) @_spi(ExperimentalLanguageFeatures) public import SwiftSyntax
3434
#else
3535
@_spi(RawSyntax) @_spi(ExperimentalLanguageFeatures) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparser/TokenSpecStaticMembersFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let tokenSpecStaticMembersFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
@_spi(RawSyntax) internal import SwiftSyntax
2323
#else
2424
@_spi(RawSyntax) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparserdiagnostics/ChildNameForDiagnosticsFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let childNameForDiagnosticFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
@_spi(ExperimentalLanguageFeatures) internal import SwiftSyntax
2323
#else
2424
@_spi(ExperimentalLanguageFeatures) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparserdiagnostics/SyntaxKindNameForDiagnosticsFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let syntaxKindNameForDiagnosticFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
@_spi(ExperimentalLanguageFeatures) internal import SwiftSyntax
2323
#else
2424
@_spi(ExperimentalLanguageFeatures) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparserdiagnostics/TokenNameForDiagnosticsFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let tokenNameForDiagnosticFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
@_spi(RawSyntax) internal import SwiftSyntax
2323
#else
2424
@_spi(RawSyntax) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let buildableNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
@_spi(ExperimentalLanguageFeatures) public import SwiftSyntax
2323
#else
2424
@_spi(ExperimentalLanguageFeatures) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntaxbuilder/RenamedChildrenBuilderCompatibilityFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let renamedChildrenBuilderCompatibilityFile = try! SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
public import SwiftSyntax
2323
#else
2424
import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntaxbuilder/ResultBuildersFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let resultBuildersFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
@_spi(ExperimentalLanguageFeatures) public import SwiftSyntax
2323
#else
2424
@_spi(ExperimentalLanguageFeatures) import SwiftSyntax

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntaxbuilder/SyntaxExpressibleByStringInterpolationConformancesFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let syntaxExpressibleByStringInterpolationConformancesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
DeclSyntax(
2020
"""
21-
#if swift(>=6)
21+
#if compiler(>=6)
2222
internal import SwiftSyntax
2323
#else
2424
import SwiftSyntax

Sources/SwiftBasicFormat/BasicFormat.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
@_spi(RawSyntax) public import SwiftSyntax
1515
#else
1616
@_spi(RawSyntax) import SwiftSyntax

Sources/SwiftBasicFormat/Indenter.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftBasicFormat/InferIndentation.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftBasicFormat/Syntax+Extensions.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftBasicFormat/SyntaxProtocol+Formatted.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftBasicFormat/Trivia+FormatExtensions.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftCompilerPlugin/CompilerPlugin.swift

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

13-
#if swift(>=6.0)
13+
#if compiler(>=6)
1414
public import SwiftSyntaxMacros
1515
@_spi(PluginMessage) private import SwiftCompilerPluginMessageHandling
1616
#else

Sources/SwiftCompilerPluginMessageHandling/CompilerPluginMessageHandler.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if swift(>=6)
14-
private import _SwiftSyntaxCShims
13+
#if compiler(>=6)
14+
@_implementationOnly private import _SwiftSyntaxCShims
1515
public import SwiftSyntaxMacros
1616
#else
1717
@_implementationOnly import _SwiftSyntaxCShims

Sources/SwiftCompilerPluginMessageHandling/Diagnostics.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
internal import SwiftDiagnostics
1515
internal import SwiftSyntax
1616
#else

Sources/SwiftCompilerPluginMessageHandling/JSON/JSONDecoding.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if swift(>=6.0)
14-
private import _SwiftSyntaxCShims
13+
#if compiler(>=6)
14+
@_implementationOnly private import _SwiftSyntaxCShims
1515
#else
1616
@_implementationOnly import _SwiftSyntaxCShims
1717
#endif

Sources/SwiftCompilerPluginMessageHandling/Macros.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
internal import SwiftBasicFormat
1515
internal import SwiftDiagnostics
1616
internal import SwiftOperators

Sources/SwiftCompilerPluginMessageHandling/PluginMacroExpansionContext.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
internal import SwiftDiagnostics
1515
internal import SwiftOperators
1616
internal import SwiftParser

Sources/SwiftCompilerPluginMessageHandling/StandardIOMessageConnection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if swift(>=6.0)
14-
private import _SwiftSyntaxCShims
13+
#if compiler(>=6)
14+
@_implementationOnly private import _SwiftSyntaxCShims
1515
#else
1616
@_implementationOnly import _SwiftSyntaxCShims
1717
#endif

Sources/SwiftDiagnostics/Convenience.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftDiagnostics/Diagnostic.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftDiagnostics/DiagnosticsFormatter.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftDiagnostics/FixIt.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftDiagnostics/GroupedDiagnostics.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftDiagnostics/Note.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftIDEUtils/DeclNameLocation.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftIDEUtils/FixItApplier.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftDiagnostics
1515
public import SwiftSyntax
1616
#else

Sources/SwiftIDEUtils/NameMatcher.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
import SwiftParser
1515
public import SwiftSyntax
1616
#else

Sources/SwiftIDEUtils/Syntax+Classifications.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftIDEUtils/SyntaxClassification.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
@_spi(RawSyntax) internal import SwiftSyntax
1515
#else
1616
@_spi(RawSyntax) import SwiftSyntax

Sources/SwiftIDEUtils/SyntaxClassifier.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
@_spi(RawSyntax) public import SwiftSyntax
1515
#else
1616
@_spi(RawSyntax) import SwiftSyntax

Sources/SwiftIDEUtils/Utils.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
internal import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftLibraryPluginProvider/LibraryPluginProvider.swift

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

13-
#if swift(>=6.0)
13+
#if compiler(>=6)
1414
public import SwiftSyntaxMacros
1515
@_spi(PluginMessage) public import SwiftCompilerPluginMessageHandling
1616
private import _SwiftLibraryPluginProviderCShims

Sources/SwiftOperators/Operator.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftOperators/OperatorError+Diagnostics.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftDiagnostics
1515
internal import SwiftParser
1616
internal import SwiftSyntax

Sources/SwiftOperators/OperatorError.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftOperators/OperatorTable+Defaults.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
internal import SwiftSyntax
1515
#else
1616
import SwiftSyntax

Sources/SwiftOperators/OperatorTable+Folding.swift

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

13-
#if swift(>=6)
13+
#if compiler(>=6)
1414
public import SwiftSyntax
1515
#else
1616
import SwiftSyntax

0 commit comments

Comments
 (0)