@@ -1517,7 +1517,10 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
15171517 }
15181518 }
15191519 }
1520- c.check_expected_arg_count (mut node, func) or { return func.return_type }
1520+ c.check_expected_arg_count (mut node, func) or {
1521+ node.return_type = func.return_type
1522+ return func.return_type
1523+ }
15211524 }
15221525 // println / eprintln / panic can print anything
15231526 if args_len > 0 && fn_name in print_everything_fns {
@@ -2358,7 +2361,10 @@ fn (mut c Checker) method_call(mut node ast.CallExpr, mut continue_check &bool)
23582361 node.is_field = true
23592362 info := field_sym.info as ast.FnType
23602363
2361- c.check_expected_arg_count (mut node, info.func) or { return info.func.return_type }
2364+ c.check_expected_arg_count (mut node, info.func) or {
2365+ node.return_type = info.func.return_type
2366+ return info.func.return_type
2367+ }
23622368 node.return_type = info.func.return_type
23632369 mut earg_types := []ast.Type{}
23642370
@@ -2546,7 +2552,10 @@ fn (mut c Checker) method_call(mut node ast.CallExpr, mut continue_check &bool)
25462552 && method.ctdefine_idx != ast.invalid_type_idx {
25472553 node.should_be_skipped = c.evaluate_once_comptime_if_attribute (mut method.attrs[method.ctdefine_idx])
25482554 }
2549- c.check_expected_arg_count (mut node, method) or { return method.return_type }
2555+ c.check_expected_arg_count (mut node, method) or {
2556+ node.return_type = method.return_type
2557+ return method.return_type
2558+ }
25502559 mut exp_arg_typ := ast.no_type // type of 1st arg for special builtin methods
25512560 mut param_is_mut := false
25522561 mut no_type_promotion := false
0 commit comments