Skip to content

checker: struct defined on function taking vararg as parameter can be misdetected an non-vararg #25504

Description

@dy-tea

Describe the bug

Reported by @koplenov.

Made a smaller repro of his issue below.

Reproduction Steps

struct As {
}

type Aa = string | int

fn (s As) b(aa ...Aa) int {
	return 0
}

fn (s As) a(s2 &As, aa ...Aa) int {
	a := s2.b(aa)
	return a
}

fn main() {
	s := As{}
	a := []Aa{}
	println(s.a(&s, ...a))
}

Expected Behavior

Should print 0.

Current Behavior

❯ v run test.v
test.v:11:10: error: to pass `aa` (Aa) to `b` (which accepts type `...Aa`), use `...aa`
    9 |
   10 | fn (s As) a(s2 &As, aa ...Aa) int {
   11 |     a := s2.b(aa)
      |             ~~~~~
   12 |     return a
   13 | }

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.12 8342968

Environment details (OS name and version, etc.)

V full version V 0.4.12 8342968
OS linux, "CachyOS"
Processor 12 cpus, 64bit, little endian, 13th Gen Intel(R) Core(TM) i5-1335U
Memory 1.92GB/15.31GB
V executable /home/dylan/Repos/v/v
V last modified time 2025-10-14 15:06:26
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/Repos/v
Git version git version 2.51.0
V git status weekly.2025.42-6-g6a0b15bd
.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.Unit: CheckerBugs/feature requests, that are related to the type checker.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions