diff options
| author | gingerBill <bill@gingerbill.org> | 2018-08-09 17:59:18 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-08-09 17:59:18 +0100 |
| commit | 708907df31b86e9ddec0e6204121a9f59714e75d (patch) | |
| tree | 39e37181a263c1561b9a579b1719fb1e1f8463e5 /src/check_expr.cpp | |
| parent | 70586b1cf81dcf7940bd39ce7b2c18ed8f0d2aa5 (diff) | |
`auto_cast` for named parameters
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 5427fcd65..e3b4cd7d3 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4101,10 +4101,18 @@ CALL_ARGUMENT_CHECKER(check_named_call_arguments) { } else { i64 s = 0; if (!check_is_assignable_to_with_score(c, o, e->type, &s)) { - if (show_error) { - check_assignment(c, o, e->type, str_lit("procedure argument")); + bool ok = false; + if (e->flags & EntityFlag_AutoCast) { + ok = check_is_castable_to(c, o, e->type); + } + if (ok) { + s = assign_score_function(10); + } else { + if (show_error) { + check_assignment(c, o, e->type, str_lit("procedure argument")); + } + err = CallArgumentError_WrongTypes; } - err = CallArgumentError_WrongTypes; } score += s; } |