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

0 commit comments

Comments
 (0)