Skip to content
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

Compiler error when trying to infer generics with a nested map #23329

Closed
hungrybluedev opened this issue Jan 1, 2025 · 0 comments · Fixed by #23332
Closed

Compiler error when trying to infer generics with a nested map #23329

hungrybluedev opened this issue Jan 1, 2025 · 0 comments · Fixed by #23332
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Compiler Panic The V compiler itself paniced. It should not, it should produce nice and readable errors instead. Modules: x.json2 Bugs related to *only* x.json2 (the pure V implementation) Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Checker Bugs/feature requests, that are related to the type checker. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.

Comments

@hungrybluedev
Copy link
Member

hungrybluedev commented Jan 1, 2025

V doctor:

V full version: V 0.4.9 7b9b3dd
OS: macos, macOS, 15.1.1, 24B91
Processor: 10 cpus, 64bit, little endian, Apple M1 Pro

getwd: /Users/subhomoyhaldar/Documents/GitHub/VProjects/Consultation/vhammll
vexe: /Users/subhomoyhaldar/Documents/GitHub/v-main/v
vexe mtime: 2025-01-01 10:54:25

vroot: OK, value: /Users/subhomoyhaldar/Documents/GitHub/v-main
VMODULES: OK, value: /Users/subhomoyhaldar/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.39.5 (Apple Git-154)
Git vroot status: weekly.2024.53
.git/config present: true

CC version: Apple clang version 16.0.0 (clang-1600.0.26.6)
emcc version: N/A
thirdparty/tcc status: thirdparty-macos-arm64 713692d4

What did you do?
./v -g -o vdbg cmd/v && ./vdbg scratch/error.v

import x.json2

struct CrossVerifyResult {
	confusion_matrix_map map[string]map[string]f64
}

fn main() {
	x := json2.decode[CrossVerifyResult]('')!
	dump(x)
}

What did you expect to see?

I was expecting a compilation error or success.

What did you see instead?

================ V panic ================
   module: v.ast
 function: default_table_panic_handler()
  message: table.sym: invalid type (typ=ast.Type(0x0 = 0) idx=0). Compiler bug. This should never happen. Please report the bug using `v bug file.v`.

     file: /Users/subhomoyhaldar/Documents/GitHub/v-main/vlib/v/ast/table.v:131
   v hash: 7b9b3dd
=========================================
0   vdbg                                0x0000000102bfcdac v__ast__Table_panic + 0
1   vdbg                                0x0000000102bfcdf4 v__ast__Table_panic + 72
2   vdbg                                0x0000000102bf0edc v__ast__Table_sym + 312
3   vdbg                                0x0000000102c67274 v__checker__Checker_infer_fn_generic_types + 4904
4   vdbg                                0x0000000102ceb2b8 v__checker__Checker_fn_call + 42136
5   vdbg                                0x0000000102cacd90 v__checker__Checker_call_expr + 496
6   vdbg                                0x0000000102c51398 v__checker__Checker_expr + 3544
7   vdbg                                0x0000000102c47b9c v__checker__Checker_assign_stmt + 1052
8   vdbg                                0x0000000102c6af6c v__checker__Checker_stmt + 396
9   vdbg                                0x0000000102c7a278 v__checker__Checker_stmts_ending_with_expression + 612
10  vdbg                                0x0000000102c93a00 v__checker__Checker_stmts + 60
11  vdbg                                0x0000000102cb7f00 v__checker__Checker_if_expr + 9920
12  vdbg                                0x0000000102c520e8 v__checker__Checker_expr + 6952
13  vdbg                                0x0000000102c6b520 v__checker__Checker_stmt + 1856
14  vdbg                                0x0000000102c7a278 v__checker__Checker_stmts_ending_with_expression + 612
15  vdbg                                0x0000000102c93a00 v__checker__Checker_stmts + 60
16  vdbg                                0x0000000102c9be90 v__checker__Checker_for_in_stmt + 8876
17  vdbg                                0x0000000102c6b884 v__checker__Checker_stmt + 2724
18  vdbg                                0x0000000102c7a278 v__checker__Checker_stmts_ending_with_expression + 612
19  vdbg                                0x0000000102c93a00 v__checker__Checker_stmts + 60
20  vdbg                                0x0000000102c98b78 v__checker__Checker_fn_decl + 20832
21  vdbg                                0x0000000102c6e0cc v__checker__Checker_post_process_generic_fns + 972
22  vdbg                                0x0000000102c6d03c v__checker__Checker_check_files + 3008
23  vdbg                                0x0000000102e7ddec v__builder__Builder_middle_stages + 208
24  vdbg                                0x0000000102e7faec v__builder__Builder_front_and_middle_stages + 120
25  vdbg                                0x0000000102e93fe4 v__builder__cbuilder__gen_c + 84
26  vdbg                                0x0000000102e93d9c v__builder__cbuilder__build_c + 288
27  vdbg                                0x0000000102e93c24 v__builder__cbuilder__compile_c + 568
28  vdbg                                0x0000000102e8dcf8 v__builder__Builder_rebuild + 108
29  vdbg                                0x0000000102e8d6e4 v__builder__compile + 92
30  vdbg                                0x0000000102e97228 main__rebuild + 164
31  vdbg                                0x0000000102e96e14 main__main + 3780
32  vdbg                                0x0000000102e9aa40 main + 76
33  dyld                                0x00000001941b4274 start + 2840

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.

Huly®: V_0.6-21760

@hungrybluedev hungrybluedev added the Bug This tag is applied to issues which reports bugs. label Jan 1, 2025
@spytheman spytheman added Unit: Checker Bugs/feature requests, that are related to the type checker. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. Compiler Panic The V compiler itself paniced. It should not, it should produce nice and readable errors instead. Status: Confirmed This bug has been confirmed to be valid by a contributor. Modules: x.json2 Bugs related to *only* x.json2 (the pure V implementation) labels Jan 1, 2025
@felipensp felipensp self-assigned this Jan 1, 2025
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. Compiler Panic The V compiler itself paniced. It should not, it should produce nice and readable errors instead. Modules: x.json2 Bugs related to *only* x.json2 (the pure V implementation) Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Checker Bugs/feature requests, that are related to the type checker. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants