v
v copied to clipboard
Cgen error: `could not generate string method 'void_str' for type 'void'`
Describe the bug
See code: https://play.vlang.io/?query=481ebca0e6
fn foo() ? {
return none, 100
}
fn main() {
println(foo())
}
Expected Behavior
No cgen error
Current Behavior
Cgen error:
cgen error: could not generate string method `void_str` for type `void`
Reproduction Steps
Run code above
Possible Solution
No response
Additional Information/Context
No response
V version
0.3.3
Environment details (OS name and version, etc.)
Playground
I think that it is already fixed by the other issue.
The playground needs to be updated. It still gives this message. Latest V on desktop says
foo.v:2:9: error: can only return `none` from an Option-only return function
1 | fn foo() ? {
2 | return none, 100
| ~~~~
3 | }
4 |
However, if you fix the code to only return none, you do still get the error message...
fn foo() ? {
return none
}
fn main() {
println(foo())
}
says
cgen error: could not generate string method `void_str` for type `void`