Skip to content

Commit fabfcc7

Browse files
authored
Merge pull request #50 from CodaFi/to-the-bitter-end
Fix a pattern parsing bug
2 parents 2b0eefb + 110791c commit fabfcc7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Tests/LLVMTests/FileCheck.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,15 @@ private class Pattern {
821821
regExPattern += "("
822822
curParen += 1
823823

824-
let (res, paren) = self.addRegExToRegEx(patternStr.substring(from: patternStr.index(patternStr.startIndex, offsetBy: 2)), curParen)
824+
let substr = patternStr.substring(
825+
with: Range<String.Index>(
826+
uncheckedBounds: (
827+
patternStr.index(patternStr.startIndex, offsetBy: 2),
828+
End.lowerBound
829+
)
830+
)
831+
)
832+
let (res, paren) = self.addRegExToRegEx(substr, curParen)
825833
curParen = paren
826834
if res {
827835
return true

0 commit comments

Comments
 (0)