From 5dd5d460f154c146d26f115706a21b7808658edf Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 31 Oct 2026 00:48:25 +0100 Subject: Fix error span for missing return message --- boot/name_analysis.cc | 3 +-- boot/parser.yy | 7 +++++-- boot/type_check.cc | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'boot') diff --git a/boot/name_analysis.cc b/boot/name_analysis.cc index 11380db..9305cd2 100644 --- a/boot/name_analysis.cc +++ b/boot/name_analysis.cc @@ -1628,8 +1628,7 @@ namespace elna::boot this->bag.leave(); info_object->parameters = type_parameters; info_object->exported = declaration->identifier.exported(); - info_object->position.emplace(declaration->position().start(), - declaration->heading().position().end()); + info_object->position.emplace(declaration->position()); info_object->file = this->module_file; info_object->noreturn = noreturn; diff --git a/boot/parser.yy b/boot/parser.yy index fa701ec..c4e514b 100644 --- a/boot/parser.yy +++ b/boot/parser.yy @@ -328,12 +328,15 @@ procedure_heading: procedure_declaration: "proc" identifier_definition procedure_heading procedure_body { - $$ = new boot::procedure_declaration(boot::make_position(@$), + $$ = new boot::procedure_declaration( + boot::make_position(yy::location(@1.begin, @3.end)), std::move(*$2), $3, std::move(*$4)); } | "proc" identifier_definition procedure_heading "extern" { - $$ = new boot::procedure_declaration(boot::make_position(@$), std::move(*$2), $3); + $$ = new boot::procedure_declaration( + boot::make_position(yy::location(@1.begin, @3.end)), + std::move(*$2), $3); } call_expression: designator_expression actual_parameter_list diff --git a/boot/type_check.cc b/boot/type_check.cc index 14a5099..7adaaed 100644 --- a/boot/type_check.cc +++ b/boot/type_check.cc @@ -198,7 +198,7 @@ namespace elna::boot + this->actual.to_string() + "'"; } return describe_callable(payload.identifier) - + " is expected to return, but does not have a return statement"; + + " is expected to return a value, but has no return expression"; } else if constexpr (std::is_same_v) -- cgit v1.2.3