Skip to content

vlib,tests: fix array's param use signed int#25324

Merged
spytheman merged 2 commits into
vlang:masterfrom
kbkpbot:fix-vlib-64bit-int-1
Sep 17, 2025
Merged

vlib,tests: fix array's param use signed int#25324
spytheman merged 2 commits into
vlang:masterfrom
kbkpbot:fix-vlib-64bit-int-1

Conversation

@kbkpbot

@kbkpbot kbkpbot commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

This PR fix vlib for future apply 64bit int.
Allow use i64, i32, i16, i8 as an array's param.

And also fix vlib/v/gen/c/testdata/translated/ files to workaround int in source code and generated code.

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-25730

@spytheman

Copy link
Copy Markdown
Contributor

imho change the check to:

    if sym.kind !in [.int, .i32, .int_literal] {
        c.error('array ${para} needs to be an int', pos)
    }

sizeof(i32) is always <= sizeof(int) even when int becomes 64 bit, so passing an i32 value to that field should be allowed

@kbkpbot kbkpbot changed the title vlib,tests: fix int i32 for 64bit int vlib,tests: fix array's param use signed int Sep 17, 2025

@spytheman spytheman left a comment

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.

Excellent work.
Thank you @kbkpbot 🙇🏻‍♂️.

@spytheman spytheman merged commit 16c9bf2 into vlang:master Sep 17, 2025
83 checks passed
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.

2 participants