aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-06-20 16:08:26 +0100
committergingerBill <bill@gingerbill.org>2023-06-20 16:08:26 +0100
commit26e06ba6a68bf9812b92d59629aaa426f2659a5f (patch)
tree70d6c66e070bf18a7e0986ae4ae0b8997caa79c8 /src/check_stmt.cpp
parent7c57dde2556b95a0ef206efd93fc23f8fd0bdf89 (diff)
Correct `check_call_arguments_new_and_improved` logic
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++) {