aboutsummaryrefslogtreecommitdiff
path: root/boot/type_check.cc
diff options
context:
space:
mode:
Diffstat (limited to 'boot/type_check.cc')
-rw-r--r--boot/type_check.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/boot/type_check.cc b/boot/type_check.cc
index 797282c..5a8170a 100644
--- a/boot/type_check.cc
+++ b/boot/type_check.cc
@@ -250,7 +250,7 @@ namespace elna::boot
return "Condition must be a boolean expression, but got '"
+ this->actual.to_string() + "'";
case array_index:
- return "Array index must be an integral type, but got '"
+ return "Array index must be of type 'Word' or 'Int', but got '"
+ this->actual.to_string() + "'";
case non_indexable:
return "Indexing is not allowed on type '"
@@ -1528,12 +1528,12 @@ namespace elna::boot
{
walking_visitor::visit(expression);
- if (!is_integral_type(resolve_underlying_type(expression->start().type_decoration)))
+ if (!is_index_type(expression->start().type_decoration, this->target))
{
add_error<type_requirement_error>(expression->start().position(),
expression->start().type_decoration, type_requirement_error::kind::array_index);
}
- if (!is_integral_type(resolve_underlying_type(expression->end().type_decoration)))
+ if (!is_index_type(expression->end().type_decoration, this->target))
{
add_error<type_requirement_error>(expression->end().position(),
expression->end().type_decoration, type_requirement_error::kind::array_index);
@@ -1551,7 +1551,7 @@ namespace elna::boot
add_error<type_requirement_error>(expression->position(),
expression->base().type_decoration, type_requirement_error::kind::non_indexable);
}
- if (!is_integral_type(resolve_underlying_type(expression->index().type_decoration)))
+ if (!is_index_type(expression->index().type_decoration, this->target))
{
add_error<type_requirement_error>(expression->index().position(),
expression->index().type_decoration, type_requirement_error::kind::array_index);