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

arrays.concat doesn't work as expected with empty interface types #19976

Closed
einar-hjortdal opened this issue Nov 23, 2023 · 0 comments · Fixed by #20002
Closed

arrays.concat doesn't work as expected with empty interface types #19976

einar-hjortdal opened this issue Nov 23, 2023 · 0 comments · Fixed by #20002
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@einar-hjortdal
Copy link
Contributor

einar-hjortdal commented Nov 23, 2023

Describe the bug

import arrays

interface AnythingGoes{ }

mut the_one_array := []AnythingGoes{}

some_string := 'It would suck'
another_string := 'if I was forced'
last_string := 'to << every var into the array'
random_int := 69

// this produces an error, but it shouldn't!
the_one_array = arrays.concat(the_one_array, some_string, another_string, last_string, random_int)

// this works but it sucks
the_one_array = arrays.concat(
	the_one_array, 
	AnythingGoes(some_string), 
	AnythingGoes(another_string), 
	AnythingGoes(last_string), 
	AnythingGoes(random_int)
	) 

// this also works and it sucks
the_one_array << some_string
the_one_array << another_string
the_one_array << last_string
the_one_array << random_int

println(the_one_array)

Reproduction Steps

Run code above, one apoproach at a time

Expected Behavior

the_one_array = arrays.concat(the_one_array, some_string, another_string, last_string, random_int) should just work

Current Behavior

the_one_array = arrays.concat(the_one_array, some_string, another_string, last_string, random_int) produces errors

Possible Solution

No response

Additional Information/Context

No response

V version

Current V version: V 0.4.3 29eda89, timestamp: 2023-11-23 16:07:00 +0200

Environment details (OS name and version, etc.)

V full version: V 0.4.3 95509cf.29eda89
OS: linux, Linux version 5.14.0-362.8.1.el9_3.x86_64 (mockbuild@pp-el9) (gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2), GNU ld version 2.35.2-42.el9) #1 SMP PREEMPT_DYNAMIC Tue Nov 7 18:43:14 CET 2023
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz

getwd: /home/jdb/Documents/projects/vlang/redis
vexe: /home/jdb/.local/lib64/v/v
vexe mtime: 2023-11-23 14:16:00

vroot: OK, value: /home/jdb/.local/lib64/v
VMODULES: OK, value: /home/jdb/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.39.3
Git vroot status: weekly.2023.45.1-111-g29eda896
.git/config present: true

CC version: cc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

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.

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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant