-
-
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
generics not working in external modules #2528
Comments
Can you show the whole code? |
Module code Code: bubble_generic_module.v |
works for me
|
Module is working fine? For me |
@medvednikov It works only with all code in single file. Try to compile with the module. import sorty
fn main() {
mut nums := [1, 7, 0, 5, 6, 3]
sorty.bubble(nums)
println(nums)
} This gives an error:
|
Concerning the mutability of the immutable array - this works because of the line in the function mut var := nums And then modifying |
Another interesting note. I put the module code in the file
I did not do anything with module |
Fixed. |
V version:
V 0.1.21 753fe32
OS:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Codename: bionic
What did you do?
Wrote a sorting function using generics. Worked fine. Made the same function into a module and builds fine. Returns funny error when using the library
What did you expect to see?
Correct Output.
What did you see instead?
test.v:6:24: unexpected token:
,
5| fn main() {
6| nums := [1, 7, 0, 5, 6, 3]
The text was updated successfully, but these errors were encountered: