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.
This commit is contained in:
bogwi
2025-05-05 15:14:06 +09:00
parent ee8aeea381
commit af0e067a12
3 changed files with 17 additions and 1 deletions
+5 -1
View File
@@ -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;