From a768dc206c379341318bc29e5feafb1bf6394c54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Fri, 8 Jan 2021 13:20:20 +0100 Subject: [PATCH] :art: Remove tflag_ctmpl --- include/env/type.h | 15 +++++++-------- src/import/import_cdef.c | 2 +- src/lib/object_op.c | 1 - src/parse/template.c | 2 +- tests/new/template_class_in_template.gw | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/env/type.h b/include/env/type.h index 64068fa2..68bbec1f 100644 --- a/include/env/type.h +++ b/include/env/type.h @@ -27,14 +27,13 @@ enum tflag { tflag_empty = 1 << 7, tflag_ftmpl = 1 << 8, tflag_ntmpl = 1 << 9, // do NOT need types - tflag_ctmpl = 1 << 10, // child template - tflag_udef = 1 << 11, - tflag_cdef = 1 << 12, - tflag_struct = 1 << 13, - tflag_ctor = 1 << 14, - tflag_dtor = 1 << 15, - tflag_tmpl = 1 << 16, - tflag_typedef = 1 << 17, + tflag_udef = 1 << 10, + tflag_cdef = 1 << 11, + tflag_struct = 1 << 12, + tflag_ctor = 1 << 13, + tflag_dtor = 1 << 14, + tflag_tmpl = 1 << 15, + tflag_typedef = 1 << 16, } __attribute__((packed)); struct Type_ { diff --git a/src/import/import_cdef.c b/src/import/import_cdef.c index 889eb1b2..7bd34371 100644 --- a/src/import/import_cdef.c +++ b/src/import/import_cdef.c @@ -79,7 +79,7 @@ ANN2(1,2) Type gwi_class_ini(const Gwi gwi, const m_str name, const m_str parent if(td->array) set_tflag(t, tflag_typedef); if(ck.tmpl) - set_tflag(t, tflag_tmpl); + set_tflag(t, tflag_tmpl | tflag_ntmpl); else gwi_type_flag(t); return type_finish(gwi, t); diff --git a/src/lib/object_op.c b/src/lib/object_op.c index 6a68ad60..5d88e83e 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -238,7 +238,6 @@ ANN static m_bool scantmpl_class_def(const Env env, struct tmpl_info *info) { if((info->ret = cdef->base.type)) { info->ret->info->cdef = cdef; set_tflag(info->ret, tflag_cdef); - set_tflag(info->ret, tflag_ctmpl); } else free_class_def(env->gwion->mp, cdef); return ret; diff --git a/src/parse/template.c b/src/parse/template.c index 88af4878..28f0f5d0 100644 --- a/src/parse/template.c +++ b/src/parse/template.c @@ -97,7 +97,7 @@ static ANN Type maybe_func(const Env env, const Type t, const Type_Decl* td) { ANN Type _scan_type(const Env env, const Type t, Type_Decl* td) { if(tflag(t, tflag_tmpl) && isa(t, env->gwion->type[et_function]) < 0) { - if(tflag(t, tflag_ctmpl) || (tflag(t, tflag_ntmpl) && !td->types)) + if(tflag(t, tflag_ntmpl) && !td->types) return t; struct TemplateScan ts = { .t=t, .td=td }; struct Op_Import opi = { .op=insert_symbol("@scan"), .lhs=t, .data=(uintptr_t)&ts, .pos=td->pos, .op_type=op_scan }; diff --git a/tests/new/template_class_in_template.gw b/tests/new/template_class_in_template.gw index efdc68c1..8db17222 100644 --- a/tests/new/template_class_in_template.gw +++ b/tests/new/template_class_in_template.gw @@ -4,5 +4,5 @@ class Parent:[A] { 13 => var B B; } } -var Parent.C:[int, int] c; +var Parent:[int].C:[int] c; <<< c.a >>>; -- 2.43.0