-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
V doesn't figure out array type in match
, but it should
#22828
Labels
Bug
This tag is applied to issues which reports bugs.
Comments
I think the next case is related to what is reported here: fn count_str(array []string) int {
return array.len
}
fn count_int(array []int) int {
return array.len
}
fn count[T](array []T) int {
return array.len
}
assert count_str(['one','two']) == 2
assert count_str([]string{}) == 0
assert count_str([]) == 0 // WORKS
assert count_int([1,2]) == 2
assert count_int([]int{}) == 0
assert count_int([]) == 0 // WORKS
assert count[f64]([1.0,2.0]) == 2
assert count[f64]([]f64{}) == 0
assert count[f64]([]) == 0 // error: cannot use `[]T` as `[]f64` in argument 1 to `count` All |
@jorgeluismireles this an issue with generics. Please create a separate issue. |
kahgoh
added a commit
to kahgoh/exercism-vlang
that referenced
this issue
Jan 16, 2025
This is to fix the following error in the CI build: error: array_init: no type specified (maybe: `[]Type{}` instead of `[]`) This probably started happening with Vlang 0.4.9, which has changes to empty arrays (see vlang/v#22828 and https://github.com/vlang/v/blob/master/CHANGELOG.md).
keiravillekode
pushed a commit
to exercism/vlang
that referenced
this issue
Jan 17, 2025
* Update how empty array is initialized This is to fix the following error in the CI build: error: array_init: no type specified (maybe: `[]Type{}` instead of `[]`) This probably started happening with Vlang 0.4.9, which has changes to empty arrays (see vlang/v#22828 and https://github.com/vlang/v/blob/master/CHANGELOG.md). * Update utf8.get_uchar to .get_rune This is to fix the following warning: warning: function `encoding.utf8.get_uchar` has been deprecated since 2024-11-17, it will be an error after 2025-05-16; use `.get_rune(s string, index int)` instead [no important files changed]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Should compile, instead getting an error:
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: