mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 13:07:48 +00:00
(cherry picked from commit 5bd1afc3f9)
This commit is contained in:
@@ -1447,6 +1447,7 @@ proc genNewSeqOfCap(p: BProc; e: PNode; d: var TLoc) =
|
||||
getSeqPayloadType(p.module, seqtype),
|
||||
])
|
||||
else:
|
||||
if d.k == locNone: getTemp(p, e.typ, d, needsInit=false) # bug #22560
|
||||
putIntoDest(p, d, e, ropecg(p.module,
|
||||
"($1)#nimNewSeqOfCap($2, $3)", [
|
||||
getTypeDesc(p.module, seqtype),
|
||||
|
||||
@@ -214,3 +214,20 @@ for i in 0..100:
|
||||
var test = newSeqOfCap[uint32](1)
|
||||
test.setLen(1)
|
||||
doAssert test[0] == 0, $(test[0], i)
|
||||
|
||||
|
||||
# bug #22560
|
||||
doAssert len(newSeqOfCap[int](42)) == 0
|
||||
|
||||
block: # bug #17197
|
||||
type Matrix = seq[seq[int]]
|
||||
|
||||
proc needlemanWunsch(sequence1: string, sequence2: string, gap_penal: int8, match: int8, indel_penal: int8): bool =
|
||||
let seq2_len = sequence2.len
|
||||
|
||||
var grid: Matrix
|
||||
for i in sequence1:
|
||||
grid.add(newSeqOfCap[seq[int]](seq2_len))
|
||||
result = true
|
||||
|
||||
doAssert needlemanWunsch("ABC", "DEFG", 1, 2, 3)
|
||||
|
||||
Reference in New Issue
Block a user