Skip to content

shallow() issues #1094

@fowlmouth

Description

@fowlmouth
var x,y: seq[int]
y = @[]
shallow y

x = y
x.add 1

echo "x: ", x, ", y: ", y

output: x: @[1], y: @[1563515712, 0, 0, 2]

var x,y: string
y = ""
shallow y

x = y
x.add "42"

echo "x: ", x, ", y: ", y

output: x: 42, y:

The string test works fine when the code is in a block or the initial string has len > 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions