diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index 0ac9b2109c..5423a042f8 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -359,7 +359,7 @@ fn (mut p Parser) fn_args() ([]table.Arg, bool) { mut args := []table.Arg{} mut is_variadic := false // `int, int, string` (no names, just types) - types_only := p.tok.kind in [.amp, .and] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) || + types_only := p.tok.kind in [.amp, .and, .ellipsis] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) || p.peek_tok.kind == .rpar // TODO copy pasta, merge 2 branches if types_only { diff --git a/vlib/v/tests/interop_test.v b/vlib/v/tests/interop_test.v new file mode 100644 index 0000000000..6d13d872be --- /dev/null +++ b/vlib/v/tests/interop_test.v @@ -0,0 +1,16 @@ +// Not real external functions, so we won't call them +// We just want to make sure they compile + +struct Foo {} + +fn C.a(a string, b int) f32 +fn C.b(a &voidptr) +fn C.c(a string, b ...string) string +fn C.d(a ...int) + +fn JS.e(a string, b ...string) int +fn JS.f(a &Foo) // TODO: Should this be allowed? + +fn C.g(string, ...int) +fn C.h(&int) +fn JS.i(...string)