summaryrefslogtreecommitdiff
path: root/src/parser/parser_type.c
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-21 22:50:20 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-21 22:50:31 +0000
commit260f01af1d3c19827d175740e30da57a288a6e86 (patch)
treee81e36c0297c22eefa6988c0306ea87211d78314 /src/parser/parser_type.c
parenta552bd6b8175fe833e8a77dfb051bf3481df6851 (diff)
Fix for #74
Diffstat (limited to 'src/parser/parser_type.c')
-rw-r--r--src/parser/parser_type.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/parser/parser_type.c b/src/parser/parser_type.c
index 3d5bff8..4e44c00 100644
--- a/src/parser/parser_type.c
+++ b/src/parser/parser_type.c
@@ -443,7 +443,23 @@ Type *parse_type_base(ParserContext *ctx, Lexer *l)
}
// Call multi-arg instantiation
- instantiate_generic_multi(ctx, name, args, arg_count, t);
+ int is_generic_dep = 0;
+ for (int i = 0; i < arg_count; ++i)
+ {
+ for (int k = 0; k < ctx->known_generics_count; ++k)
+ {
+ if (strcmp(args[i], ctx->known_generics[k]) == 0)
+ {
+ is_generic_dep = 1;
+ break;
+ }
+ }
+ }
+
+ if (!is_generic_dep)
+ {
+ instantiate_generic_multi(ctx, name, args, arg_count, t);
+ }
// Build mangled name
char mangled[256];
@@ -481,7 +497,21 @@ Type *parse_type_base(ParserContext *ctx, Lexer *l)
}
char *unmangled_arg = type_to_c_string(first_arg);
- instantiate_generic(ctx, name, first_arg_str, unmangled_arg, t);
+
+ int is_single_dep = 0;
+ for (int k = 0; k < ctx->known_generics_count; ++k)
+ {
+ if (strcmp(first_arg_str, ctx->known_generics[k]) == 0)
+ {
+ is_single_dep = 1;
+ break;
+ }
+ }
+
+ if (!is_single_dep)
+ {
+ instantiate_generic(ctx, name, first_arg_str, unmangled_arg, t);
+ }
free(unmangled_arg);
char *clean_arg = sanitize_mangled_name(first_arg_str);