aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2023-06-23 12:11:46 +0100
committerGitHub <noreply@github.com>2023-06-23 12:11:46 +0100
commit9841b11a5423e2cba67c19fbd06e28732d36109c (patch)
tree7c067cbc1501c4a044a80944ca282dd7da974074 /src/check_stmt.cpp
parent5a6d5374d780e726be82f3576b4f647d9096d012 (diff)
parentc48057081e451c81524c7727ec3ccf434a45726f (diff)
Merge pull request #2597 from odin-lang/ordered-named-arguments
Allowing for Positional and Named Arguments in Procedure Calls
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 09af496ab..cf6f998e5 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -2207,7 +2207,13 @@ gb_internal void check_return_stmt(CheckerContext *ctx, Ast *node) {
} else if (operands.count != result_count) {
// Ignore error message as it has most likely already been reported
if (all_operands_valid(operands)) {
- error(node, "Expected %td return values, got %td", result_count, operands.count);
+ if (operands.count == 1) {
+ gbString t = type_to_string(operands[0].type);
+ error(node, "Expected %td return values, got %td (%s)", result_count, operands.count, t);
+ gb_string_free(t);
+ } else {
+ error(node, "Expected %td return values, got %td", result_count, operands.count);
+ }
}
} else {
for (isize i = 0; i < result_count; i++) {