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

checker, cgen: fix generics call with interface arg(fix #19976) #20002

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Nov 26, 2023

  1. Fixed arrays.concat doesn't work as expected with empty interface types #19976
  2. Add tests.
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)

println(the_one_array)

outputs:

[AnythingGoes('It would suck'), AnythingGoes('if I was forced'), AnythingGoes('to << every var into the array'), AnythingGoes(69)]

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@spytheman spytheman merged commit fc99781 into vlang:master Nov 27, 2023
54 checks passed
@shove70 shove70 deleted the generic_iface branch November 27, 2023 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

arrays.concat doesn't work as expected with empty interface types
2 participants