From 128a564be05afb1cb2ec76884a81c2bd536899fd Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 3 Oct 2026 00:46:51 +0200 Subject: Replace noreturn type with an attribute --- boot/type_check.cc | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'boot/type_check.cc') diff --git a/boot/type_check.cc b/boot/type_check.cc index 15a01dc..ea0bcd5 100644 --- a/boot/type_check.cc +++ b/boot/type_check.cc @@ -413,8 +413,8 @@ namespace elna::boot return opaque; } } - return !procedure->return_type.proper_type.empty() - ? find_opaque_type(procedure->return_type.proper_type) + return !procedure->return_type.empty() + ? find_opaque_type(procedure->return_type) : std::nullopt; } return std::nullopt; @@ -723,18 +723,18 @@ namespace elna::boot } ++parameter_index; } - if (declaration->heading().return_type.proper_type != nullptr) + if (declaration->heading().return_type != nullptr) { - if (auto opaque = find_opaque_type(this->current_procedure->symbol.return_type.proper_type)) + if (auto opaque = find_opaque_type(this->current_procedure->symbol.return_type)) { add_error( - declaration->heading().return_type.proper_type->position(), + declaration->heading().return_type->position(), opaque.value(), type_requirement_error::kind::opaque_return); } - else if (auto found = find_zero_sized(this->current_procedure->symbol.return_type.proper_type, this->target)) + else if (auto found = find_zero_sized(this->current_procedure->symbol.return_type, this->target)) { add_error( - declaration->heading().return_type.proper_type->position(), + declaration->heading().return_type->position(), found.value(), type_requirement_error::kind::zero_sized); } } @@ -750,7 +750,7 @@ namespace elna::boot void type_analysis_visitor::check_return(const procedure_body& body, const source_position position, const std::string& name) { - const type return_type = this->current_procedure->symbol.return_type.proper_type; + const type return_type = this->current_procedure->symbol.return_type; if (body.return_expression == nullptr) { @@ -990,18 +990,17 @@ namespace elna::boot parameter, type_requirement_error::kind::zero_sized); } } - if (!procedure->return_type.proper_type.empty()) + if (!procedure->return_type.empty()) { - if (const auto opaque = find_opaque_type(procedure->return_type.proper_type)) + if (const auto opaque = find_opaque_type(procedure->return_type)) { add_error(declaration->position(), opaque.value(), type_requirement_error::kind::opaque_return); } - else if (has_zero_size(procedure->return_type.proper_type, this->target)) + else if (has_zero_size(procedure->return_type, this->target)) { add_error(declaration->position(), - procedure->return_type.proper_type, - type_requirement_error::kind::zero_sized); + procedure->return_type, type_requirement_error::kind::zero_sized); } } } @@ -1079,8 +1078,8 @@ namespace elna::boot return true; } } - return !procedure->return_type.proper_type.empty() - && occurs_in(parameter, procedure->return_type.proper_type); + return !procedure->return_type.empty() + && occurs_in(parameter, procedure->return_type); } else if (const auto instance = subject.get()) { @@ -1206,10 +1205,8 @@ namespace elna::boot return false; } } - return left_procedure->return_type.proper_type.empty() - || bind_arguments(parameters, bindings, - left_procedure->return_type.proper_type, - right_procedure->return_type.proper_type); + return left_procedure->return_type.empty() + || bind_arguments(parameters, bindings, left_procedure->return_type, right_procedure->return_type); } return true; } @@ -1424,7 +1421,7 @@ namespace elna::boot // just bound. if (const auto substituted = callable_type.get()) { - call->type_decoration = substituted->return_type.proper_type; + call->type_decoration = substituted->return_type; } } } -- cgit v1.2.3