aboutsummaryrefslogtreecommitdiff
path: root/src/name_canonicalization.cpp
diff options
context:
space:
mode:
authorbogwi <bogwi@rakumail.jp>2025-05-05 15:14:06 +0900
committerbogwi <bogwi@rakumail.jp>2025-05-05 16:58:14 +0900
commitaf0e067a12079cc16020e264c6157bb5581c9cf4 (patch)
treec80ae6c2ca286f39bedf3c9ced3501f9bec5ef1c /src/name_canonicalization.cpp
parentee8aeea38163c18a9b3513717bd09d3765c0d6d8 (diff)
CHECK 2 done
Add support for handling generic types in LLVM backend - Updated `lb_type_internal` to return a pointer type for unspecialized generics. - Modified `write_type_to_canonical_string` to handle specialized generics without panicking. - Enhanced `default_type` to return the default type of specialized generics when applicable.
Diffstat (limited to 'src/name_canonicalization.cpp')
-rw-r--r--src/name_canonicalization.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/name_canonicalization.cpp b/src/name_canonicalization.cpp
index 6aa933e86..0372f5039 100644
--- a/src/name_canonicalization.cpp
+++ b/src/name_canonicalization.cpp
@@ -756,8 +756,12 @@ gb_internal void write_type_to_canonical_string(TypeWriter *w, Type *type) {
type_writer_appendc(w, "/");
write_type_to_canonical_string(w, type->Generic.specialized);
}
+ } else if (type->Generic.specialized) {
+ // If we have a specialized type, use that instead of panicking
+ write_type_to_canonical_string(w, type->Generic.specialized);
} else {
- GB_PANIC("Type_Generic should never be hit");
+ // For unspecialized generics, use a generic placeholder string
+ type_writer_appendc(w, "rawptr");
}
return;