make tests green again

This commit is contained in:
Araq 2018-08-21 20:33:47 +02:00
commit f12a5431a1
3 changed files with 3 additions and 5 deletions

View file

@ -136,7 +136,7 @@ proc openArrayLoc(p: BProc, n: PNode): Rope =
of tyString, tySequence: of tyString, tySequence:
var t: TLoc var t: TLoc
t.r = "(*$1)" % [a.rdLoc] t.r = "(*$1)" % [a.rdLoc]
result = "(*$1)$3, (*$1 ? (*$1)->$2 : 0)" % [a.rdLoc, lenExpr(p, t), dataField(p)] result = "(*$1)$3, $2" % [a.rdLoc, lenExpr(p, t), dataField(p)]
of tyArray: of tyArray:
result = "$1, $2" % [rdLoc(a), rope(lengthOrd(p.config, lastSon(a.t)))] result = "$1, $2" % [rdLoc(a), rope(lengthOrd(p.config, lastSon(a.t)))]
else: else:

View file

@ -161,10 +161,7 @@ proc peekLast*[T](deq: Deque[T]): T {.inline.} =
result = deq.data[(deq.tail - 1) and deq.mask] result = deq.data[(deq.tail - 1) and deq.mask]
template destroy(x: untyped) = template destroy(x: untyped) =
when defined(nimNewRuntime) and not supportsCopyMem(type(x)): reset(x)
`=destroy`(x)
else:
reset(x)
proc popFirst*[T](deq: var Deque[T]): T {.inline, discardable.} = proc popFirst*[T](deq: var Deque[T]): T {.inline, discardable.} =
## Remove and returns the first element of the `deq`. ## Remove and returns the first element of the `deq`.

View file

@ -4112,6 +4112,7 @@ template once*(body: untyped): untyped =
{.pop.} #{.push warning[GcMem]: off, warning[Uninit]: off.} {.pop.} #{.push warning[GcMem]: off, warning[Uninit]: off.}
proc substr*(s: string, first, last: int): string = proc substr*(s: string, first, last: int): string =
let first = max(first, 0)
let L = max(min(last, high(s)) - first + 1, 0) let L = max(min(last, high(s)) - first + 1, 0)
result = newString(L) result = newString(L)
for i in 0 .. L-1: for i in 0 .. L-1: