Closed einar-hjortdal closed 1 year ago
VV_LOCAL_SYMBOL redis__StatusCmd redis__Cmdable_ping(redis__Cmdable c) {
redis__StatusCmd cmd = redis__new_status_cmd(new_array_from_c_array(1, 1, sizeof(x__json2__Any), _MOV((x__json2__Any[1]){string_to_sumtype_x__json2__Any(ADDR(string, (_SLIT("ping"))))})));
c.cmdable_function(cmd); // <<----- error
return cmd;
}
error: cannot convert 'struct redisStatusCmd' to 'struct redisCmder'
As a workaround, you can cast the StatusCmd to Cmder one, like:
diff --git a/src/cmdable.v b/src/cmdable.v
index 4714a99..d9706cd 100644
--- a/src/cmdable.v
+++ b/src/cmdable.v
@@ -18,7 +18,7 @@ mut:
fn (c Cmdable) ping() StatusCmd {
cmd := new_status_cmd('ping')
- c.cmdable_function(cmd)
+ c.cmdable_function(Cmder(cmd))
return cmd
}
@@ -38,19 +38,19 @@ mut:
pub fn (c CmdableStateful) auth(password string) StatusCmd {
cmd := new_status_cmd('auth', password)
- c.cmdable_stateful_function(cmd)
+ c.cmdable_stateful_function(Cmder(cmd))
return cmd
}
pub fn (c CmdableStateful) auth_acl(username string, password string) StatusCmd {
cmd := new_status_cmd('auth', username, password)
- c.cmdable_stateful_function(cmd)
+ c.cmdable_stateful_function(Cmder(cmd))
return cmd
}
@medvednikov is it expected to be done automatically, right?
Thanks for the help. I also assumed it should be done automatically.
Describe the bug
Ran into this cgen error, don't know how to isolate it so I am linking the repository here. The branch cgen_error is not going to change so the problem will be frozen in time.
error: cannot convert 'struct __StatusCmd' to 'struct __Cmder'
Expected Behavior
Not a cgen error
Current Behavior
cgen error
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
V version
Current V version: V 0.3.4 499d052, timestamp: 2023-06-28 13:40:36 +0300
Environment details (OS name and version, etc.)