diff options
| author | bogwi <bogwi@rakumail.jp> | 2025-05-05 14:18:11 +0900 |
|---|---|---|
| committer | bogwi <bogwi@rakumail.jp> | 2025-05-05 16:50:40 +0900 |
| commit | ee8aeea38163c18a9b3513717bd09d3765c0d6d8 (patch) | |
| tree | 3397d232c019f8ace2a1b56614dd73b53574e6c7 /src/llvm_backend_const.cpp | |
| parent | 93f80f60fbebf28c4c40a71908452611e524b53c (diff) | |
CHECK 1 done
Fix panic in LLVM backend when using generic procedure with default arguments
- Fixed panic in `llvm_backend_proc.cpp` when using unspecialized polymorphic procedures as defaults.
- Ensured correct type inference when generic procedures are used as default parameters.
Diffstat (limited to 'src/llvm_backend_const.cpp')
| -rw-r--r-- | src/llvm_backend_const.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index dada2cff5..51c8a4449 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -533,7 +533,10 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, lb Entity *e = entity_from_expr(expr); res = lb_find_procedure_value_from_entity(m, e); } - GB_ASSERT(res.value != nullptr); + if (res.value == nullptr) { + // This is an unspecialized polymorphic procedure, return nil or dummy value + return lb_const_nil(m, original_type); + } GB_ASSERT(LLVMGetValueKind(res.value) == LLVMFunctionValueKind); if (LLVMGetIntrinsicID(res.value) == 0) { |