-
-
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
CGEN error with map having optional sumtype #23650
Labels
Bug
This tag is applied to issues which reports bugs.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Comments
is it normal that I dont see the file supposedly attached? |
Connected to Huly®: V_0.6-22071 |
Working on smaller example |
main.01JK78A4RYHEH8QSB91F8JYPHN.tmp.zip Smaller example compiles fine not sure how to create a smaller one that gets the build error. Here is the C code generating the error webdriver__remote__ConnectionManager webdriver__remote__RemoteConnection_get_connection_manager(webdriver__remote__RemoteConnection* r) {
Map_string__option_webdriver__remote__Any pool_manager_args = new_map(sizeof(string), sizeof(_option_webdriver__remote__Any), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)
;
if ((r->client_config).state != 2) {
map_set(&pool_manager_args, &(string[]){_SLIT("timeout")}, &(_option_webdriver__remote__Any[]) { (*(webdriver__remote__ClientConfig*)(r->client_config.data)).timeout });
if (((*(webdriver__remote__ClientConfig*)(r->client_config.data)).init_args_for_pool_manager).state != 2) {
maps__merge_in_place_T_string__option_webdriver__remote__Any(&pool_manager_args, (*(Map_string_webdriver__remote__Any*)((*(webdriver__remote__ClientConfig*)(r->client_config.data)).init_args_for_pool_manager.data)));
}
if ((*(webdriver__remote__ClientConfig*)(r->client_config.data)).ignore_certificates) {
_option_webdriver__remote__Any _t1;
_option_ok(&(webdriver__remote__Any[]) { _SLIT("CERT_NONE") }, (_option*)(&_t1), sizeof(webdriver__remote__Any));
map_set(&pool_manager_args, &(string[]){_SLIT("cert_reqs")}, &(_option_webdriver__remote__Any[]) { _t1 });
} else if (((*(webdriver__remote__ClientConfig*)(r->client_config.data)).ca_certs).state != 2) {
_option_webdriver__remote__Any _t2;
_option_ok(&(webdriver__remote__Any[]) { _SLIT("CERT_REQUIRED") }, (_option*)(&_t2), sizeof(webdriver__remote__Any));
map_set(&pool_manager_args, &(string[]){_SLIT("cert_reqs")}, &(_option_webdriver__remote__Any[]) { _t2 });
_option_webdriver__remote__Any _t3;
_option_ok(&(webdriver__remote__Any[]) { (*(string*)((*(webdriver__remote__ClientConfig*)(r->client_config.data)).ca_certs.data)) }, (_option*)(&_t3), sizeof(webdriver__remote__Any));
map_set(&pool_manager_args, &(string[]){_SLIT("ca_certs")}, &(_option_webdriver__remote__Any[]) { _t3 });
}
}
if ((r->proxy_url).state != 2) {
if (string_starts_with(string_to_lower((*(string*)(r->proxy_url.data))), _SLIT("sock"))) {
return ((webdriver__remote__ConnectionManager){.url = (*(string*)(r->proxy_url.data)),.args = pool_manager_args,});
}
}
return ((webdriver__remote__ConnectionManager){.url = (string){.str=(byteptr)"", .is_lit=1},.args = pool_manager_args,});
} |
40 |
main.01JK78A4RYHEH8QSB91F8JYPHN.tmp.c
S:\temp\v_0\main.01JK78A4RYHEH8QSB91F8JYPHN.tmp.c(34260): error C2440: 'initializing': cannot convert from '_option_int' to 'byte'
S:\temp\v_0\main.01JK78A4RYHEH8QSB91F8JYPHN.tmp.c(34266): error C2440: 'initializing': cannot convert from 'string' to '_option_int *'
S:\temp\v_0\main.01JK78A4RYHEH8QSB91F8JYPHN.tmp.c(34270): error C2440: 'initializing': cannot convert from 'string' to '_option_int *'
S:\temp\v_0\main.01JK78A4RYHEH8QSB91F8JYPHN.tmp.c(34273): error C2440: 'initializing': cannot convert from 'string' to '_option_int *' |
type Any = ?int | ?string
struct TestConfig {
timeout ?int
}
struct Test {
client_config TestConfig
}
fn main() {
mut r := Test{
client_config: TestConfig{
timeout: 0
}
}
mut pool_manager_args := map[string]?Any{}
pool_manager_args['timeout'] = r.client_config.timeout
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
This tag is applied to issues which reports bugs.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
V version: V 0.4.9 5c04f32, press to see full `v doctor` output
What did you do?
./v -g -o vdbg cmd/v && ./vdbg -cg main.v && S:\vProjects\vSelenium\main.exe
See attached file
main.v
What did you see?
The text was updated successfully, but these errors were encountered: