1
0
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:
Alexander Medvednikov 2020-05-28 01:19:03 +02:00
parent e89ae7e194
commit 4988d340b1
2 changed files with 8 additions and 3 deletions

View File

@ -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 {
left_type := c.expr(call_expr.left)
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
// TODO: remove this for actual methods, use only for compiler magic
// 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 {
for t in sym.mr_info().types {
got_types << t
}
}
} else {
got_types << typ
}

View File

@ -56,6 +56,12 @@ mut:
foo string
}
fn (u User) init() {
}
fn (c City) init() {
}
fn test_create() {
create<User>()
create<City>()
@ -204,5 +210,4 @@ fn test_generic_fn_with_variadics(){
p(abc)
p('Good','morning','world')
}
*/