Skip to content

v checker panic if incorrect number of parameters supplied to method #25204

Description

@dy-tea

Describe the bug

Checker panics when running included code snippet. Found while writing test cases for #25178. Haven't looked too deeply but it's probably somewhat related to that issue.

Reproduction Steps

fn main() {
	mut m := map[string]int
	m['test'] = 10
	map_delete := m.delete()
}

Expected Behavior

Map delete returns void so maybe we need an error here?

Current Behavior

V panic: array.get: index out of range (i,a.len):0, 0
v hash: cb2756e
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:19677: at _v_panic: Backtrace
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:19725: by panic_n2
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:19231: by array_get
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:644: by v__checker__Checker_map_builtin_method_call
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:65026: by v__checker__Checker_method_call
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:63608: by v__checker__Checker_call_expr
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:54528: by v__checker__Checker_expr
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:49130: by v__checker__Checker_assign_stmt
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:53661: by v__checker__Checker_stmt
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:54285: by v__checker__Checker_stmts_ending_with_expression
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:54262: by v__checker__Checker_stmts
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:63389: by v__checker__Checker_fn_decl
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:53709: by v__checker__Checker_stmt
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:51574: by v__checker__Checker_check
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:51635: by v__checker__Checker_check_files
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:53318: by v__builder__Builder_middle_stages
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:53359: by v__builder__Builder_front_and_middle_stages
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:55889: by v__builder__cbuilder__gen_c
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:55861: by v__builder__cbuilder__build_c
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:55852: by v__builder__cbuilder__compile_c
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:55769: by v__builder__Builder_rebuild
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:54921: by v__builder__compile
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:56290: by main__rebuild
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:56203: by main__main
/tmp/v_1000/v2.01K3Y9KY3GYMXJ5EQMTV5QMH44.tmp.c:57111: by main

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.11 cb2756e

Environment details (OS name and version, etc.)

V full version V 0.4.11 2ac3478.cb2756e
OS linux, "CachyOS"
Processor 16 cpus, 64bit, little endian, AMD Ryzen 7 5700G with Radeon Graphics
Memory 6.18GB/13.55GB
V executable /home/dylan/Repos/v/v
V last modified time 2025-08-30 20:10:07
V home dir OK, value: /home/dylan/Repos/v
VMODULES OK, value: /home/dylan/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/dylan
Git version git version 2.51.0
V git status weekly.2025.35-22-gcb2756e3-dirty
.git/config present true
cc version cc (GCC) 15.2.1 20250813
gcc version gcc (GCC) 15.2.1 20250813
clang version clang version 20.1.8
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (GNU libc) 2.42

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.

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.Modules: builtinBugs and problems, concerning the builtin types in V - array, maps, strings, runes.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.Unit: vlibBugs/feature requests, that are related to the vlib.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions