mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
This commit is contained in:
parent
30b3ab6f41
commit
9b6578e883
2 changed files with 18 additions and 1 deletions
|
@ -154,7 +154,7 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) {
|
|||
arg := node.args.last()
|
||||
param := m.params[node.args.len]
|
||||
|
||||
arg.expr is ast.Ident && g.table.type_to_str(arg.typ) == '[]string'
|
||||
arg.expr in [ast.IndexExpr, ast.Ident] && g.table.type_to_str(arg.typ) == '[]string'
|
||||
&& g.table.type_to_str(param.typ) != '[]string'
|
||||
} else {
|
||||
false
|
||||
|
|
17
vlib/v/tests/comptimecall_slice_arg_test.v
Normal file
17
vlib/v/tests/comptimecall_slice_arg_test.v
Normal file
|
@ -0,0 +1,17 @@
|
|||
struct Dummy {}
|
||||
|
||||
fn (d Dummy) sample(x int) int {
|
||||
return x + 1
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
args := ['0', '5']
|
||||
$for method in Dummy.methods {
|
||||
if args.len > 1 {
|
||||
assert Dummy{}.$method(args[1 ..]) == 6
|
||||
|
||||
tmp := args[1..]
|
||||
assert Dummy{}.$method(tmp) == 6
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue