Skip to content

Commit 87c0155

Browse files
checker: add back str method fix removed in call expr merge
1 parent fc0e117 commit 87c0155

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

vlib/v/checker/checker.v

+11
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,17 @@ pub fn (c mut Checker) call_expr(call_expr mut ast.CallExpr) table.Type {
234234
call_expr.return_type = method.return_type
235235
return method.return_type
236236
}
237+
// TODO: str methods
238+
if left_type_sym.kind == .map && method_name == 'str' {
239+
call_expr.receiver_type = table.new_type(c.table.type_idxs['map_string'])
240+
call_expr.return_type = table.string_type
241+
return table.string_type
242+
}
243+
if left_type_sym.kind == .array && method_name == 'str' {
244+
call_expr.receiver_type = left_type
245+
call_expr.return_type = table.string_type
246+
return table.string_type
247+
}
237248
c.error('unknown method: ${left_type_sym.name}.$method_name', call_expr.pos)
238249
return table.void_type
239250
}

0 commit comments

Comments
 (0)