Skip to content

cgen: fix array contains codegen for fixed array#22579

Merged
spytheman merged 3 commits intovlang:masterfrom
felipensp:fix_fixed_array_contains
Oct 20, 2024
Merged

cgen: fix array contains codegen for fixed array#22579
spytheman merged 3 commits intovlang:masterfrom
felipensp:fix_fixed_array_contains

Conversation

@felipensp
Copy link
Copy Markdown
Member

Fix #22559

@felipensp felipensp changed the title cgen: fix array containds codegen for fixed array cgen: fix array contains codegen for fixed array Oct 18, 2024
@@ -0,0 +1,8 @@
fn test_main() {
mut a := [][2]int{}
a << [0, 0]!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0 is not a good value for testing, because the default initialisation also uses 0s.
Using another value like 1, 3, or 42 makes the test more sensitive/less likely to continue to work, if eventually a value was overwritten (wrongly) by 0s in the implementation.

Copy link
Copy Markdown
Contributor

@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.

Excellent work.

@spytheman spytheman marked this pull request as ready for review October 20, 2024 00:55
@spytheman spytheman merged commit d8edb13 into vlang:master Oct 20, 2024
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.

Short program using arrays fails to compile

2 participants