mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 14:55:24 +00:00
* fixes #20958; fixes the return type of slice function
* add a testcase
(cherry picked from commit 3d5edb41be)
This commit is contained in:
@@ -402,6 +402,9 @@ proc transformSlices(g: ModuleGraph; idgen: IdGenerator; n: PNode): PNode =
|
||||
let op = n[0].sym
|
||||
if op.name.s == "[]" and op.fromSystem:
|
||||
result = copyNode(n)
|
||||
var typ = newType(tyOpenArray, nextTypeId(g.idgen), result.typ.owner)
|
||||
typ.add result.typ[0]
|
||||
result.typ = typ
|
||||
let opSlice = newSymNode(createMagic(g, idgen, "slice", mSlice))
|
||||
opSlice.typ = getSysType(g, n.info, tyInt)
|
||||
result.add opSlice
|
||||
|
||||
Reference in New Issue
Block a user