From b4d88ee4af50c95b902ca0cb29b1cea5a8c21ae0 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 26 May 2020 02:09:26 +0200 Subject: [PATCH] checker: handle map.clone() --- vlib/v/checker/checker.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 9e4f16629e..dd52fd3604 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -731,6 +731,10 @@ pub fn (mut c Checker) call_method(mut call_expr ast.CallExpr) table.Type { // call_expr.return_type = call_expr.receiver_type } return call_expr.return_type + } else if left_type_sym.kind == .map && method_name == 'clone' { + call_expr.return_type = left_type + call_expr.receiver_type = left_type.to_ptr() + return call_expr.return_type } else if left_type_sym.kind == .array && method_name in ['first', 'last'] { info := left_type_sym.info as table.Array call_expr.return_type = info.elem_type