Skip to content

Commit 6fa8ba9

Browse files
committed
Revert incidental update to Swift 3.2
1 parent 8a2ecbb commit 6fa8ba9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Sources/FileCheck/CheckString.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct CheckString {
104104

105105
// Note any variables used by the pattern
106106
for (varName, _) in self.pattern.variableUses {
107-
if varName.first == "@" {
107+
if varName.characters.first == "@" {
108108
// If we failed with a builtin variable like @LINE, try to report
109109
// what it is bound to.
110110
if let value = self.pattern.evaluateExpression(varName) {
@@ -142,7 +142,7 @@ struct CheckString {
142142
var BestLine : Int? = nil
143143
var BestQuality = 0.0
144144

145-
for i in 0..<min(buffer.count, 4096) {
145+
for i in 0..<min(buffer.characters.count, 4096) {
146146
let exampleString : String
147147
if pattern.fixedString.isEmpty {
148148
exampleString = pattern.regExPattern
@@ -180,7 +180,7 @@ struct CheckString {
180180
buffer.utf8CString.withUnsafeBufferPointer { buf in
181181
let otherPatternLoc = CheckLoc.inBuffer(
182182
buf.baseAddress!.advanced(by: Best),
183-
UnsafeBufferPointer(rebasing: buf.suffix(from: Best))
183+
UnsafeBufferPointer(start: buf.baseAddress?.advanced(by: Best), count: buf.count - Best)
184184
)
185185
diagnose(.note, at: otherPatternLoc, with: "possible intended match here", options: options)
186186
}

Sources/FileCheck/Pattern.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,11 @@ final class Pattern {
350350
var mutTable = variableTable
351351
for (v, index) in self.variableDefs {
352352
assert(index < fullMatch.numberOfRanges, "Internal paren error")
353-
let r = fullMatch.range(at: index)
353+
#if os(macOS)
354+
let r = fullMatch.rangeAt(index)
355+
#else
356+
let r = fullMatch.range(at: index)
357+
#endif
354358
mutTable[v] = buffer.substring(
355359
with: Range<String.Index>(
356360
uncheckedBounds: (

0 commit comments

Comments
 (0)