Skip to content

Commit cc9c211

Browse files
committed
Integrate newer string processing (a0ed7e1)
Friend PR: swiftlang/swift-experimental-string-processing#282. Also remove the `-enable-experimental-pairwise-build-block` flag when building regex modules as the feature is already on by default.
1 parent 7fb1fd1 commit cc9c211

File tree

11 files changed

+14
-11
lines changed

11 files changed

+14
-11
lines changed

stdlib/public/RegexBuilder/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ add_swift_target_library(swiftRegexBuilder ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
4040
-DswiftRegexBuilder_EXPORTS
4141
SWIFT_COMPILE_FLAGS
4242
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
43-
-Xfrontend -enable-experimental-pairwise-build-block
4443
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
4544

4645
SWIFT_MODULE_DEPENDS _StringProcessing

stdlib/public/StringProcessing/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ add_swift_target_library(swift_StringProcessing ${SWIFT_STDLIB_LIBRARY_BUILD_TYP
4141
-Dswift_StringProcessing_EXPORTS
4242
SWIFT_COMPILE_FLAGS
4343
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
44-
-Xfrontend -enable-experimental-pairwise-build-block
4544
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
4645

4746
SWIFT_MODULE_DEPENDS _RegexParser

test/SourceKit/Sema/sema_regex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ public func retRegex() -> Regex<Substring> {
33
}
44

55
// REQUIRES: swift_in_compiler
6-
// RUN: %sourcekitd-test -req=sema %s -- %s -Xfrontend -enable-bare-slash-regex | %FileCheck %s
6+
// RUN: %sourcekitd-test -req=sema %s -- %s -Xfrontend -enable-bare-slash-regex -Xfrontend -disable-availability-checking | %FileCheck %s
77

88
// CHECK: [
99
// CHECK: {

test/StringProcessing/Frontend/enable-flag.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ prefix operator / // expected-error {{prefix operator may not contain '/'}}
99
_ = /x/
1010
_ = #/x/#
1111

12+
@available(SwiftStdlib 5.7, *)
1213
func foo(_ x: Regex<Substring>) {}

test/StringProcessing/Parse/forward-slash-regex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex
1+
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -disable-availability-checking
22
// REQUIRES: swift_in_compiler
33
// REQUIRES: concurrency
44

test/StringProcessing/Parse/regex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex
1+
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -disable-availability-checking
22
// REQUIRES: swift_in_compiler
33

44
_ = /abc/
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex
1+
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -disable-availability-checking
22
// REQUIRES: swift_in_compiler
33

44
// Note there is purposefully no trailing newline here.
55
// expected-error@+1 {{unterminated regex literal}}
6-
var unterminated = #/xy
6+
var unterminated = #/xy

test/StringProcessing/Parse/regex_parse_error.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex
1+
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -disable-availability-checking
22
// REQUIRES: swift_in_compiler
33

44
_ = /(/ // expected-error {{expected ')'}}

test/StringProcessing/Runtime/regex_basic.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import StdlibUnittest
77
var RegexBasicTests = TestSuite("RegexBasic")
88

99
extension String {
10+
@available(SwiftStdlib 5.7, *)
1011
func expectMatch<T>(
1112
_ regex: Regex<T>,
1213
file: String = #file,
1314
line: UInt = #line
1415
) -> Regex<T>.Match {
15-
guard let result = matchWhole(regex) else {
16+
guard let result = wholeMatch(of: regex) else {
1617
expectUnreachable("Failed match", file: file, line: line)
1718
fatalError()
1819
}
@@ -21,6 +22,7 @@ extension String {
2122
}
2223

2324
RegexBasicTests.test("Basic") {
25+
guard #available(SwiftStdlib 5.7, *) else { return }
2426
let input = "aabccd"
2527

2628
let match1 = input.expectMatch(#/aabcc./#)
@@ -33,6 +35,7 @@ RegexBasicTests.test("Basic") {
3335
}
3436

3537
RegexBasicTests.test("Modern") {
38+
guard #available(SwiftStdlib 5.7, *) else { return }
3639
let input = "aabccd"
3740

3841
let match1 = input.expectMatch(#/
@@ -43,6 +46,7 @@ RegexBasicTests.test("Modern") {
4346
}
4447

4548
RegexBasicTests.test("Captures") {
49+
guard #available(SwiftStdlib 5.7, *) else { return }
4650
let input = """
4751
A6F0..A6F1 ; Extend # Mn [2] BAMUM COMBINING MARK KOQNDON..BAMUM \
4852
COMBINING MARK TUKWENTIS

test/StringProcessing/Sema/regex_literal_type_inference.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex
1+
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -disable-availability-checking
22
// REQUIRES: swift_in_compiler
33

44
let r0 = #/./#

test/StringProcessing/Sema/string_processing_import.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -enable-experimental-string-processing -disable-implicit-string-processing-module-import
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-string-processing -disable-implicit-string-processing-module-import -disable-availability-checking
22
// REQUIRES: swift_in_compiler
33

44
// expected-error @+1 {{missing 'Regex' declaration, probably because the '_StringProcessing' module was not imported properly}}

0 commit comments

Comments
 (0)