aboutsummaryrefslogtreecommitdiff
path: root/src/types.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/types.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/types.cpp')
-rw-r--r--src/types.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index 9c9472a28..cd33f1a0f 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -2932,6 +2932,10 @@ gb_internal Type *default_type(Type *type) {
case Basic_UntypedString: return t_string;
case Basic_UntypedRune: return t_rune;
}
+ } else if (type->kind == Type_Generic) {
+ if (type->Generic.specialized) {
+ return default_type(type->Generic.specialized);
+ }
}
return type;
}