mirror of
https://github.com/vlang/v.git
synced 2025-09-10 07:47:20 -04:00
This commit is contained in:
parent
980912dc96
commit
d577e54152
@ -2318,6 +2318,10 @@ fn (mut g Gen) ref_or_deref_arg(arg ast.CallArg, expected_type ast.Type, lang as
|
||||
g.write(')')
|
||||
return
|
||||
}
|
||||
} else if arg_sym.kind == .interface_ && exp_sym.kind == .interface_ {
|
||||
if exp_is_ptr && !arg_is_ptr {
|
||||
g.write('&')
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if arg_typ.has_flag(.shared_f) && !expected_type.has_flag(.shared_f) {
|
||||
|
12
vlib/v/tests/fn_call_interface_args_test.v
Normal file
12
vlib/v/tests/fn_call_interface_args_test.v
Normal file
@ -0,0 +1,12 @@
|
||||
interface Foo {}
|
||||
|
||||
fn has_interface_args(mut a Foo, b &Foo, c Foo) {
|
||||
assert a == &Foo(1)
|
||||
assert b == &Foo(1)
|
||||
assert c == Foo(1)
|
||||
}
|
||||
|
||||
fn test_fn_call_interface_args() {
|
||||
mut arg := Foo(1)
|
||||
has_interface_args(mut arg, arg, arg)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user