mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
generics: fix method calls
This commit is contained in:
@ -701,7 +701,7 @@ pub fn (mut c Checker) call_expr(mut call_expr ast.CallExpr) table.Type {
|
|||||||
pub fn (mut c Checker) call_method(mut call_expr ast.CallExpr) table.Type {
|
pub fn (mut c Checker) call_method(mut call_expr ast.CallExpr) table.Type {
|
||||||
left_type := c.expr(call_expr.left)
|
left_type := c.expr(call_expr.left)
|
||||||
call_expr.left_type = left_type
|
call_expr.left_type = left_type
|
||||||
left_type_sym := c.table.get_type_symbol(left_type)
|
left_type_sym := c.table.get_type_symbol(c.unwrap_generic(left_type))
|
||||||
method_name := call_expr.name
|
method_name := call_expr.name
|
||||||
// TODO: remove this for actual methods, use only for compiler magic
|
// TODO: remove this for actual methods, use only for compiler magic
|
||||||
// FIXME: Argument count != 1 will break these
|
// FIXME: Argument count != 1 will break these
|
||||||
@ -1173,7 +1173,7 @@ pub fn (mut c Checker) return_stmt(mut return_stmt ast.Return) {
|
|||||||
if sym.kind == .multi_return {
|
if sym.kind == .multi_return {
|
||||||
for t in sym.mr_info().types {
|
for t in sym.mr_info().types {
|
||||||
got_types << t
|
got_types << t
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
got_types << typ
|
got_types << typ
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,12 @@ mut:
|
|||||||
foo string
|
foo string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn (u User) init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn (c City) init() {
|
||||||
|
}
|
||||||
|
|
||||||
fn test_create() {
|
fn test_create() {
|
||||||
create<User>()
|
create<User>()
|
||||||
create<City>()
|
create<City>()
|
||||||
@ -204,5 +210,4 @@ fn test_generic_fn_with_variadics(){
|
|||||||
p(abc)
|
p(abc)
|
||||||
p('Good','morning','world')
|
p('Good','morning','world')
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user