Skip to content

Commit

Permalink
Work around change in integer literal inference (swiftlang#798)
Browse files Browse the repository at this point in the history
* Work around change in integer literal inference

Related to swiftlang/swift#78371,
but doesn't need to be reverted after that issue is fixed.

* Fix availability for capture tests
  • Loading branch information
natecook1000 committed Jan 8, 2025
1 parent 2929df2 commit 35497fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Sources/Exercises/Participants/HandWrittenParticipant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions Sources/_StringProcessing/Regex/Match.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions Tests/RegexBuilderTests/RegexDSLTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 35497fb

Please sign in to comment.