From 4f3b6f922d6977c9a3ff278d498129785780a0e2 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 25 Nov 2025 23:48:40 +0100 Subject: [PATCH] - Resolving a missing property on a const enum with inline, reached an assert #2597. --- releasenotes.md | 1 + src/compiler/sema_name_resolution.c | 3 ++- .../enumerations/enum_no_inline_property.c3 | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/test_suite/enumerations/enum_no_inline_property.c3 diff --git a/releasenotes.md b/releasenotes.md index f289fb7d0..c62337e09 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -41,6 +41,7 @@ - Add sigsegv stacktrace in test and regular errors for Darwin Arm64. #1105 - Incorrect error message when using generic type that isn't imported #2589 - `String.to_integer` does not correctly return in some cases where it should #2590. +- Resolving a missing property on a const enum with inline, reached an assert #2597. ### Stdlib changes - Add `CGFloat` `CGPoint` `CGSize` `CGRect` types to core_foundation (macOS). diff --git a/src/compiler/sema_name_resolution.c b/src/compiler/sema_name_resolution.c index d23611590..178f1bee0 100644 --- a/src/compiler/sema_name_resolution.c +++ b/src/compiler/sema_name_resolution.c @@ -1038,7 +1038,8 @@ Decl *sema_resolve_type_method(SemaContext *context, CanonicalType *type, const type = type_decl->distinct->type->canonical; goto RETRY; case TYPE_ENUM: - type = type_decl->enums.type_info->type->canonical; + case TYPE_CONST_ENUM: + type = enum_inner_type(type); goto RETRY; default: UNREACHABLE diff --git a/test/test_suite/enumerations/enum_no_inline_property.c3 b/test/test_suite/enumerations/enum_no_inline_property.c3 new file mode 100644 index 000000000..943f0db96 --- /dev/null +++ b/test/test_suite/enumerations/enum_no_inline_property.c3 @@ -0,0 +1,12 @@ +module test; +enum MyEnum : const inline short +{ + ITEM1, + ITEM2, +} + +fn int main(String[] args) +{ + $typefrom("MyEnum").oops; // #error: No method or inner struct/union 'MyEnum.oops' + return 0; +} \ No newline at end of file