From 468f469e9b0b36611e4110f2f2a60dbb642767fc Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Fri, 11 Oct 2019 02:47:10 +0200 Subject: [PATCH] :art: Fix mk_types --- examples/binary_tmpl.gw | 5 +++++ src/parse/check.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/binary_tmpl.gw b/examples/binary_tmpl.gw index 1746eb94..3fb4c19d 100644 --- a/examples/binary_tmpl.gw +++ b/examples/binary_tmpl.gw @@ -1,6 +1,11 @@ +class C { + class D { + } +} fun void test<~A~>(A a) { <<< a >>>; } 1 => test; 1.3 => test; test(1); @(23) => test; test(1.3); +C->D d => test; diff --git a/src/parse/check.c b/src/parse/check.c index 6ce23e61..1956864a 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -421,6 +421,7 @@ ANN static Type_List mk_type_list(const Env env, const Type type) { vector_init(&v); vector_add(&v, (vtype)insert_symbol(type->name)); Nspc nspc = type->e->owner; +// TODO: simplify this while(nspc && nspc != env->curr && nspc != env->global_nspc) { const Type t = nspc_lookup_type0(nspc->parent, insert_symbol(nspc->name)); if(!t) @@ -429,8 +430,8 @@ ANN static Type_List mk_type_list(const Env env, const Type type) { nspc = nspc->parent; } ID_List id = NULL; - for(m_uint i = vector_size(&v) + 1; --i;) - id = prepend_id_list(env->gwion->mp, (Symbol)vector_at(&v, i - 1), id, new_loc(env->gwion->mp, __LINE__)); + for(m_uint i = 0 ; i < vector_size(&v); ++i) + id = prepend_id_list(env->gwion->mp, (Symbol)vector_at(&v, i), id, new_loc(env->gwion->mp, __LINE__)); vector_release(&v); assert(id); Type_Decl* td = new_type_decl(env->gwion->mp, id); -- 2.43.0