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.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/boot/type_check.cc b/boot/type_check.cc
index ab22a1c..5078da1 100644
--- a/boot/type_check.cc
+++ b/boot/type_check.cc
@@ -17,6 +17,7 @@ along with GCC; see the file COPYING3. If not see
#include "elna/boot/type_check.h"
#include "elna/boot/evaluator.h"
+#include "elna/boot/name_analysis.h"
#include <ranges>
#include <utility>
@@ -1738,7 +1739,20 @@ namespace elna::boot
add_error<trait_error>(trait->name.position(), trait->name.name(),
trait_error::unsupported_type{ trait->types.front() });
}
- else if (trait->arguments.at(1)->is_named() == nullptr)
+ else if (auto *field = trait->arguments.at(1)->is_named())
+ {
+ if (erase_generic(trait->types.front()).get<record_type>() == nullptr)
+ {
+ add_error<trait_error>(trait->name.position(), trait->name.name(),
+ trait_error::unsupported_type{ trait->types.front() });
+ }
+ else if (lookup_field(trait->types.front(), field->name).empty())
+ {
+ add_error<member_error>(field->position(), field->name,
+ trait->types.front(), member_error::kind::not_found);
+ }
+ }
+ else
{
add_error<trait_error>(trait->arguments.at(1)->position(), trait->name.name(),
trait_error::offset_not_field_name{});