mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
fixes #89
This commit is contained in:
@@ -83,7 +83,10 @@ proc openArrayLoc(p: BProc, n: PNode): PRope =
|
||||
of tyOpenArray:
|
||||
result = ropef("$1, $1Len0", [rdLoc(a)])
|
||||
of tyString, tySequence:
|
||||
result = ropef("$1->data, $1->$2", [a.rdLoc, lenField()])
|
||||
if skipTypes(n.typ, abstractInst).kind == tyVar:
|
||||
result = ropef("(*$1)->data, (*$1)->$2", [a.rdLoc, lenField()])
|
||||
else:
|
||||
result = ropef("$1->data, $1->$2", [a.rdLoc, lenField()])
|
||||
of tyArray, tyArrayConstr:
|
||||
result = ropef("$1, $2", [rdLoc(a), toRope(lengthOrd(a.t))])
|
||||
else: InternalError("openArrayLoc: " & typeToString(a.t))
|
||||
|
||||
@@ -603,8 +603,11 @@ proc genericHashAux(dest: Pointer, mt: PNimType, shallow: bool,
|
||||
result = h
|
||||
if x != nil:
|
||||
let s = cast[NimString](x)
|
||||
let y = cast[pointer](cast[int](x) -% 2*sizeof(int))
|
||||
result = result !& hash(x, s.len + 2*sizeof(int))
|
||||
when true:
|
||||
result = result !& hash(x, s.len)
|
||||
else:
|
||||
let y = cast[pointer](cast[int](x) -% 2*sizeof(int))
|
||||
result = result !& hash(y, s.len + 2*sizeof(int))
|
||||
of tySequence:
|
||||
var x = cast[ppointer](dest)
|
||||
var dst = cast[taddress](cast[ppointer](dest)[])
|
||||
@@ -627,8 +630,9 @@ proc genericHashAux(dest: Pointer, mt: PNimType, shallow: bool,
|
||||
if shallow:
|
||||
result = h !& hash(dest, mt.size)
|
||||
else:
|
||||
result = h
|
||||
var s = cast[ppointer](dest)[]
|
||||
if s != nil: result = genericHashAux(s, mt.base, shallow, h)
|
||||
if s != nil: result = genericHashAux(s, mt.base, shallow, result)
|
||||
else:
|
||||
result = h !& hash(dest, mt.size) # hash raw bits
|
||||
|
||||
|
||||
5
tests/compile/tsortcall.nim
Normal file
5
tests/compile/tsortcall.nim
Normal file
@@ -0,0 +1,5 @@
|
||||
import algorithm
|
||||
|
||||
proc foosort(ships: var seq[int]) = sort(ships, system.cmp[int])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user