We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
struct comptime and generic array can create bug.
g.v
module main struct MyStruct { f_array_string []string f_array_int []int f_array_u8 []u8 } fn arrarr[T](x []T) { $if T is $string { println('arrarr string => ${x}') } $else $if T is u8 { println('arrarr u8 => ${x}') } $else $if T is $int { println('arrarr int => ${x}') } $else { println('arrarr unknown => ${x}') } } fn main() { x := MyStruct{ f_array_int: [10244] f_array_u8: [u8(13)] f_array_string: ['hello', 'world'] } // use comptime will create wrong output $for f in MyStruct.fields { arrarr(x.$(f.name)) } // correct output arrarr(x.f_array_string) arrarr(x.f_array_int) arrarr(x.f_array_u8) }
v g.v
arrarr string => ['hello', 'world'] arrarr int => [10244] arrarr u8 => [13] arrarr string => ['hello', 'world'] arrarr int => [10244] arrarr u8 => [13]
arrarr u8 => [213, 219] arrarr u8 => [4] arrarr u8 => [13] arrarr string => ['hello', 'world'] arrarr int => [10244] arrarr u8 => [13]
No response
Not sure it is a comptime bug or a generic bug.
V 0.4.9 bd2ec67.bd2ec67
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.
The text was updated successfully, but these errors were encountered:
Connected to Huly®: V_0.6-22364
Sorry, something went wrong.
type_resolver: fix comptime_for array generic (fix #23969) (#24089)
01a719a
Successfully merging a pull request may close this issue.
Describe the bug
struct comptime and generic array can create bug.
Reproduction Steps
g.v
Expected Behavior
Current Behavior
Possible Solution
No response
Additional Information/Context
Not sure it is a comptime bug or a generic bug.
V version
V 0.4.9 bd2ec67.bd2ec67
Environment details (OS name and version, etc.)
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.
The text was updated successfully, but these errors were encountered: