Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot swap maps, neither with clone(), nor with move() #20012

Closed
mp81ss opened this issue Nov 27, 2023 · 0 comments · Fixed by #20025
Closed

Cannot swap maps, neither with clone(), nor with move() #20012

mp81ss opened this issue Nov 27, 2023 · 0 comments · Fixed by #20025
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.

Comments

@mp81ss
Copy link

mp81ss commented Nov 27, 2023

Describe the bug

fn main()
{
    mut l_map := map[int]bool
    mut r_map := map[int]bool

    l_map[0] = false
    l_map[1] = false

    r_map[0] = true
    r_map[1] = true

    l_map, r_map = r_map.move(), l_map.move()

    println(l_map)
    println(r_map)
}

Reproduction Steps

just compile the file

Expected Behavior

compilation error or support the feature

Current Behavior

/tmp/v_1000/bug.16467831999111614190.tmp.c:12656: warning: implicit declaration of function 'Map_int_bool_move'
/tmp/v_1000/bug.16467831999111614190.tmp.c:12656: error: cannot convert 'int' to 'struct map'
builder error:
...

Possible Solution

Handle coherently swapping of maps and document selected choice

Additional Information/Context

No response

V version

V 0.4.3 cd337e2

Environment details (OS name and version, etc.)

V full version: V 0.4.3 cd337e2
OS: linux, Linux Mint 21.2
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-4770S CPU @ 3.10GHz

getwd: /home/gio/lelle/ex
vexe: /home/gio/lelle/v/v
vexe mtime: 2023-11-11 13:42:45

vroot: OK, value: /home/gio/lelle/v
VMODULES: OK, value: /home/gio/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: Error: sh: 1: git: not found

Git vroot status: Error: sh: 1: git: not found
.git/config present: false

CC version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
thirdparty/tcc: N/A

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@mp81ss mp81ss added the Bug This tag is applied to issues which reports bugs. label Nov 27, 2023
@felipensp felipensp added the Unit: cgen Bugs/feature requests, that are related to the default C generating backend. label Nov 27, 2023
@felipensp felipensp self-assigned this Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants