mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: fix interface param resolution (#18780)
This commit is contained in:
parent
4a196989a9
commit
072364fc59
@ -1723,7 +1723,7 @@ fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type {
|
||||
}
|
||||
if c.table.sym(param.typ).kind == .interface_ {
|
||||
// cannot hide interface expected type to make possible to pass its interface type automatically
|
||||
earg_types << param.typ.set_nr_muls(targ.nr_muls())
|
||||
earg_types << if targ.idx() != param.typ.idx() { param.typ } else { targ }
|
||||
} else {
|
||||
earg_types << targ
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ fn (t Test) test(a ITest) {}
|
||||
|
||||
fn test(a ITest) {}
|
||||
|
||||
fn get() Test {
|
||||
return Test{}
|
||||
fn get() &Test {
|
||||
return &Test{}
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
@ -26,3 +26,11 @@ fn test_main() {
|
||||
|
||||
assert true
|
||||
}
|
||||
|
||||
fn test_ptr() {
|
||||
mut a := Cmdable{}
|
||||
a.call = test
|
||||
a.call(get())
|
||||
|
||||
assert true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user