Skip to content

Commit 32f023e

Browse files
committed
Migrate to internal imports.
As of the Swift 6 compiler, `@_implementationOnly import` is deprecated in favor of `internal import` and as a result the use of `@_implementationOnly import` in this project is generating a lot of diagnostic noise when building the Swift standard library. For Swift libraries with library evolution, `@_implementationOnly import` and `internal import` are roughly functionally equivalent, aside from improved diagnostics for `internal import`. For non-resilient libraries, the main difference is that `internal import` does not actually hide a module dependency from downstream clients because the layout of a type in a non-resilient library may depend on types coming from an `internal import` (with `@_implementationOnly import` the same situation would result in a silent mis-compile, which is the reason that `@_implementationOnly import` is deprecated). The `_RegexParser` module dependency does not need to be hidden from clients since it is installed in standard locations in the SDK/toolchain. Therefore this migration should be safe, regardless of library resilience mode.
1 parent 8b86130 commit 32f023e

27 files changed

+27
-27
lines changed

Sources/RegexBenchmark/Benchmark.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@_spi(RegexBenchmark) import _StringProcessing
2-
@_implementationOnly import _RegexParser
2+
internal import _RegexParser
33
import Foundation
44

55
protocol RegexBenchmark: Debug {

Sources/RegexBuilder/Anchor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313
@_spi(RegexBuilder) import _StringProcessing
1414

1515
/// A regex component that matches a specific condition at a particular position

Sources/RegexBuilder/CharacterClass.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313
@_spi(RegexBuilder) import _StringProcessing
1414

1515
/// A class of characters that match in a regex.

Sources/RegexBuilder/DSL.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313
@_spi(RegexBuilder) import _StringProcessing
1414

1515
@available(SwiftStdlib 5.7, *)

Sources/_StringProcessing/ByteCodeGen.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@_spi(_Unicode)
1313
import Swift
1414

15-
@_implementationOnly import _RegexParser
15+
internal import _RegexParser
1616

1717
extension Compiler {
1818
struct ByteCodeGen {

Sources/_StringProcessing/Capture.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
// TODO: Where should this live? Inside TypeConstruction?
1515
func constructExistentialOutputComponent(

Sources/_StringProcessing/Compiler.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
class Compiler {
1515
let tree: DSLTree

Sources/_StringProcessing/ConsumerInterface.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
extension Character {
1515
var _singleScalarAsciiValue: UInt8? {

Sources/_StringProcessing/Engine/InstPayload.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
extension Instruction {
1515
/// An instruction's payload packs operands and destination

Sources/_StringProcessing/Engine/MEBuilder.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser // For errors
12+
internal import _RegexParser // For errors
1313

1414
extension MEProgram {
1515
struct Builder {

Sources/_StringProcessing/Engine/MEBuiltins.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@_implementationOnly import _RegexParser // For AssertionKind
1+
internal import _RegexParser // For AssertionKind
22
extension Character {
33
var _isHorizontalWhitespace: Bool {
44
self.unicodeScalars.first?.isHorizontalWhitespace == true

Sources/_StringProcessing/Engine/MECapture.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
/*
1515

Sources/_StringProcessing/Engine/MEProgram.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
struct MEProgram {
1515
typealias Input = String

Sources/_StringProcessing/Engine/Registers.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
struct SentinelValue: Hashable, CustomStringConvertible {
1515
var description: String { "<value sentinel>" }

Sources/_StringProcessing/Engine/Structuralize.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@_implementationOnly import _RegexParser
1+
internal import _RegexParser
22

33
extension CaptureList {
44
@available(SwiftStdlib 5.7, *)

Sources/_StringProcessing/Executor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
struct Executor {
1515
// TODO: consider let, for now lets us toggle tracing

Sources/_StringProcessing/LiteralPrinter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
@available(SwiftStdlib 5.7, *)
1515
extension Regex {

Sources/_StringProcessing/MatchingOptions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
/// A type that represents the current state of regex matching options, with
1515
/// stack-based scoping.

Sources/_StringProcessing/PrintAsPattern.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
// TODO: Add an expansion level, both from top to bottom.
1515
// After `printAsCanonical` is fleshed out, these two

Sources/_StringProcessing/Regex/ASTConversion.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
extension AST {
1515
var dslTree: DSLTree {

Sources/_StringProcessing/Regex/AnyRegexOutput.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
/// The type-erased, dynamic output of a regular expression match.
1515
///

Sources/_StringProcessing/Regex/Core.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
/// A type that represents a regular expression.
1515
///

Sources/_StringProcessing/Regex/DSLTree.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
@_spi(RegexBuilder)
1515
public struct DSLTree {

Sources/_StringProcessing/Regex/Options.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
@available(SwiftStdlib 5.7, *)
1515
extension Regex {

Sources/_StringProcessing/Utility/ASTBuilder.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ AST.
2525

2626
*/
2727

28-
@_implementationOnly import _RegexParser
28+
internal import _RegexParser
2929

3030
func alt(_ asts: [AST.Node]) -> AST.Node {
3131
return .alternation(

Sources/_StringProcessing/Utility/TypeVerification.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
@available(SwiftStdlib 5.7, *)
1515
extension Regex {

Sources/_StringProcessing/_CharacterClassModel.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@_implementationOnly import _RegexParser
12+
internal import _RegexParser
1313

1414
// NOTE: This is a model type. We want to be able to get one from
1515
// an AST, but this isn't a natural thing to produce in the context

0 commit comments

Comments
 (0)