Skip to content

[swift/main] Update the Swift version to 6.0 #722

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 1 commit into from
Feb 22, 2024
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
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let availabilityDefinition = PackageDescription.SwiftSetting.unsafeFlags([
"-Xfrontend",
"-define-availability",
"-Xfrontend",
"SwiftStdlib 5.11:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999",
"SwiftStdlib 6.0:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999",
])

/// Swift settings for building a private stdlib-like module that is to be used
Expand Down
2 changes: 1 addition & 1 deletion Sources/_StringProcessing/LiteralPrinter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension Regex {
/// the `CustomConsumingRegexComponent` protocol, this property is `nil`.
///
/// The value of this property may change between different releases of Swift.
@available(SwiftStdlib 5.11, *)
@available(SwiftStdlib 6.0, *)
public var _literalPattern: String? {
var gen = LiteralPrinter(options: MatchingOptions())
gen.outputNode(self.program.tree.root)
Expand Down
8 changes: 4 additions & 4 deletions Tests/RegexTests/LiteralPrinterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import XCTest
import _StringProcessing
import RegexBuilder

@available(SwiftStdlib 5.11, *)
@available(SwiftStdlib 6.0, *)
extension RegexTests {
func testPrintableRegex() throws {
let regexString = #"([a-fGH1-9[^\D]]+)?b*cd(e.+)\2\w\S+?"#
Expand Down Expand Up @@ -56,7 +56,7 @@ extension RegexTests {
// MARK: - PrintableRegex

// Demonstration of a guaranteed Codable/Sendable regex type.
@available(SwiftStdlib 5.11, *)
@available(SwiftStdlib 6.0, *)
struct PrintableRegex: RegexComponent, @unchecked Sendable {
var pattern: String
var regex: Regex<AnyRegexOutput>
Expand All @@ -77,7 +77,7 @@ struct PrintableRegex: RegexComponent, @unchecked Sendable {
}
}

@available(SwiftStdlib 5.11, *)
@available(SwiftStdlib 6.0, *)
extension PrintableRegex: Codable {
init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
Expand All @@ -91,7 +91,7 @@ extension PrintableRegex: Codable {
}
}

@available(SwiftStdlib 5.11, *)
@available(SwiftStdlib 6.0, *)
extension PrintableRegex: CustomStringConvertible {
var description: String {
pattern
Expand Down
4 changes: 2 additions & 2 deletions Tests/RegexTests/MatchTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct MatchError: Error {

// This just piggy-backs on the existing match testing to validate that
// literal patterns round trip correctly.
@available(SwiftStdlib 5.11, *)
@available(SwiftStdlib 6.0, *)
func _roundTripLiteral(
_ regexStr: String,
syntax: SyntaxOptions
Expand Down Expand Up @@ -88,7 +88,7 @@ func _firstMatch(
}
}

if #available(SwiftStdlib 5.11, *) {
if #available(SwiftStdlib 6.0, *) {
let roundTripRegex = try? _roundTripLiteral(regexStr, syntax: syntax)
let roundTripResult = try? roundTripRegex?
.matchingSemantics(semanticLevel)
Expand Down
2 changes: 1 addition & 1 deletion Tests/RegexTests/ParseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func parseTest(
}
serializedCaptures.deallocate()

if #available(SwiftStdlib 5.11, *),
if #available(SwiftStdlib 6.0, *),
!unsupported && expectedErrors.isEmpty,
let pattern = Regex<AnyRegexOutput>(ast: ast)._literalPattern
{
Expand Down