From 93d251251ff926718b81fd62fba88dfa66d469e9 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 5 Sep 2026 23:44:04 +0200 Subject: Generate repeat-until condition outside body scope --- boot/type_check.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'boot') diff --git a/boot/type_check.cc b/boot/type_check.cc index 4ceab18..fd47998 100644 --- a/boot/type_check.cc +++ b/boot/type_check.cc @@ -18,6 +18,7 @@ along with GCC; see the file COPYING3. If not see #include "elna/boot/type_check.h" #include "elna/boot/evaluator.h" +#include #include namespace elna::boot @@ -1027,12 +1028,13 @@ namespace elna::boot type_mismatch_error::expected_type{ type(std::make_shared(type(), 0)) }); return; } - for (auto *element : expression->elements) + // The first element of the array literal determines the array type and + // does not have to be checked. + for (auto *element : expression->elements | std::views::drop(1)) { if (!is_assignable_from(array->base, element->type_decoration)) { - add_error( - element->position(), element->type_decoration, + add_error(element->position(), element->type_decoration, type_mismatch_error::expected_type{ array->base }); } } -- cgit v1.2.3