You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
internal mutating func skip(_ n: Int) {
guard n < count else {
self = Data()
return
}
for _ in 0..<n {
// -> popFirst() doesn't get executed if optimization is turned on!
assert(popFirst() != nil)
}
}
Possible fix:
internal mutating func skip(_ n: Int) {
guard n < count else {
self = Data()
return
}
for _ in 0..<n {
let check = popFirst()
assert(check != nil)
}
}
Another place where assert prevents a possibly intended side effect to occur:
In PostgreSQLData+Point:
case .point:
switch data.format {
case .text:
let string = try value.makeString()
let parts = string.split(separator: ",")
var x = parts[0]
var y = parts[1]
// -> popFirst() and popLast() will only be executed when optimization is turned off
assert(x.popFirst()! == "(")
assert(y.popLast()! == ")")
return .init(x: Double(x)!, y: Double(y)!)
The text was updated successfully, but these errors were encountered:
In utilities.swift:
Possible fix:
Another place where
assert
prevents a possibly intended side effect to occur:In PostgreSQLData+Point:
The text was updated successfully, but these errors were encountered: