@@ -1741,10 +1741,10 @@ fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type {
1741
1741
} else if (left_sym.kind == .map || final_left_sym.kind == .map )
1742
1742
&& method_name in ['clone' , 'keys' , 'values' , 'move' , 'delete' ] {
1743
1743
if left_sym.kind == .map {
1744
- return c.map_builtin_method_call (mut node, unwrapped_left_type, c.table. sym (unwrapped_left_type) )
1744
+ return c.map_builtin_method_call (mut node, left_type )
1745
1745
} else if left_sym.info is ast.Alias {
1746
- parent_type := c. unwrap_generic ( left_sym.info.parent_type)
1747
- return c.map_builtin_method_call (mut node, parent_type, c.table. final_sym (unwrapped_left_type) )
1746
+ parent_type := left_sym.info.parent_type
1747
+ return c.map_builtin_method_call (mut node, parent_type)
1748
1748
}
1749
1749
} else if left_sym.kind == .array && method_name in ['insert' , 'prepend' ] {
1750
1750
if method_name == 'insert' {
@@ -2652,9 +2652,16 @@ fn (mut c Checker) check_map_and_filter(is_map bool, elem_typ ast.Type, node ast
2652
2652
}
2653
2653
}
2654
2654
2655
- fn (mut c Checker) map_builtin_method_call (mut node ast.CallExpr, left_type ast.Type, left_sym ast.TypeSymbol ) ast.Type {
2655
+ fn (mut c Checker) map_builtin_method_call (mut node ast.CallExpr, left_type_ ast.Type) ast.Type {
2656
2656
method_name := node.name
2657
2657
mut ret_type := ast.void_type
2658
+ // resolve T
2659
+ left_type := if c.table.final_sym (left_type_).kind == .any {
2660
+ c.unwrap_generic (left_type_)
2661
+ } else {
2662
+ left_type_
2663
+ }
2664
+ left_sym := c.table.final_sym (left_type)
2658
2665
match method_name {
2659
2666
'clone' , 'move' {
2660
2667
if node.args.len != 0 {
0 commit comments