diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-09-08 21:14:03 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-09-08 21:14:03 +0200 |
| commit | b27872d5c5bfecae74195771f5c1f4e73385b6d6 (patch) | |
| tree | d0bc9d09c5b4073a42680f07a8aa3dca8df9e50b /boot | |
| parent | 47c8f99b6ef812dbc22ca56a39ba21bccad47796 (diff) | |
| download | elna-b27872d5c5bfecae74195771f5c1f4e73385b6d6.tar.gz | |
Fix ICE with offset trait and non-type identifier
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/type_check.cc | 16 |
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{}); |
