From 64162953eca5c93892ed403fbd91c6ff6b11f5af Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Tue, 7 Jan 2025 01:16:17 -0600 Subject: [PATCH 1/2] Work around change in integer literal inference Related to https://github.com/swiftlang/swift/issues/78371, but doesn't need to be reverted after that issue is fixed. --- Sources/Exercises/Participants/HandWrittenParticipant.swift | 3 ++- Sources/_StringProcessing/Regex/Match.swift | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Exercises/Participants/HandWrittenParticipant.swift b/Sources/Exercises/Participants/HandWrittenParticipant.swift index e7228b333..ef11d5e2b 100644 --- a/Sources/Exercises/Participants/HandWrittenParticipant.swift +++ b/Sources/Exercises/Participants/HandWrittenParticipant.swift @@ -60,7 +60,8 @@ private func graphemeBreakPropertyData( } // For testing our framework - if forceFailure, lower == Unicode.Scalar(0x07FD) { + let failureSigil = Unicode.Scalar(0x07FD as UInt32)! + if forceFailure, lower == failureSigil { return nil } diff --git a/Sources/_StringProcessing/Regex/Match.swift b/Sources/_StringProcessing/Regex/Match.swift index c0a3aca3c..82ed2c257 100644 --- a/Sources/_StringProcessing/Regex/Match.swift +++ b/Sources/_StringProcessing/Regex/Match.swift @@ -41,6 +41,8 @@ extension Regex.Match { from: anyRegexOutput.input ) guard let output = typeErasedMatch as? Output else { + print(typeErasedMatch) + print(Output.self) fatalError("Internal error: existential cast failed") } return output From cf07fcd4806e28eaf86ce64e8726ac97259bfdc3 Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Tue, 7 Jan 2025 11:35:55 -0600 Subject: [PATCH 2/2] Fix availability for capture tests --- Tests/RegexBuilderTests/RegexDSLTests.swift | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Tests/RegexBuilderTests/RegexDSLTests.swift b/Tests/RegexBuilderTests/RegexDSLTests.swift index 1cb53b83d..3a0c63a98 100644 --- a/Tests/RegexBuilderTests/RegexDSLTests.swift +++ b/Tests/RegexBuilderTests/RegexDSLTests.swift @@ -1845,8 +1845,8 @@ extension RegexDSLTests { } func testLabeledCaptures_labeledCapture() throws { - guard #available(macOS 13, *) else { - throw XCTSkip("Fix only exists on macOS 13") + guard #available(macOS 14.0, *) else { + throw XCTSkip("Fix only exists on macOS 14") } // The output type of a regex with a labeled capture is dropped. let dslWithLabeledCapture = Regex { @@ -1884,8 +1884,8 @@ extension RegexDSLTests { } func testLabeledCaptures_bothCapture() throws { - guard #available(macOS 13, *) else { - throw XCTSkip("Fix only exists on macOS 13") + guard #available(macOS 14.0, *) else { + throw XCTSkip("Fix only exists on macOS 14") } // Only the output type of a regex with a labeled capture is dropped, // outputs of other regexes in the same DSL are concatenated. @@ -1910,9 +1910,8 @@ extension RegexDSLTests { } func testLabeledCaptures_tooManyCapture() throws { - return - guard #available(macOS 13, *) else { - throw XCTSkip("Fix only exists on macOS 13") + guard #available(macOS 14.0, *) else { + throw XCTSkip("Fix only exists on macOS 14") } // The output type of a regex with too many captures is dropped. // "Too many" means the left and right output types would add up to >= 10.