checker: check println arg

pull/3947/head
Alexander Medvednikov 2020-03-07 00:38:35 +01:00
parent 180b9b971a
commit f699dcac94
3 changed files with 3 additions and 1 deletions

View File

@ -217,6 +217,7 @@ pub fn (c mut Checker) call_expr(call_expr mut ast.CallExpr) table.Type {
} }
// println can print anything // println can print anything
if fn_name == 'println' { if fn_name == 'println' {
c.expr(call_expr.args[0])
return f.return_type return f.return_type
} }
for i, arg_expr in call_expr.args { for i, arg_expr in call_expr.args {

View File

@ -484,6 +484,7 @@ fn (g mut Gen) expr(node ast.Expr) {
g.expr(it.left) g.expr(it.left)
g.write(', ') g.write(', ')
g.expr(it.right) g.expr(it.right)
g.write(')')
} }
else { else {
// if it.op == .dot { // if it.op == .dot {

View File

@ -89,7 +89,7 @@ i < 10; i++) {
bool b3 = get_bool() || true; bool b3 = get_bool() || true;
int f = array_int_first(nums); int f = array_int_first(nums);
string d = tos3("d"); string d = tos3("d");
println(string_add(s + d)); println(string_add(s, d));
} }
void User_inc_age(User u, int n) { void User_inc_age(User u, int n) {