From: Jérémie Astor Date: Tue, 9 Feb 2021 12:30:48 +0000 (+0100) Subject: :bug: Fix foreach in the case of an inner type X-Git-Tag: nightly~972 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=d0556a8a313499d2c18daa1e1275241809bed076;p=gwion.git :bug: Fix foreach in the case of an inner type --- diff --git a/src/parse/check.c b/src/parse/check.c index be944410..af106694 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -919,8 +919,9 @@ ANN static inline Type foreach_type(const Env env, const Exp exp) { ANN static m_bool do_stmt_each(const Env env, const Stmt_Each stmt) { DECL_OB(const Type, base, = foreach_type(env, stmt->exp)) CHECK_BB(ensure_traverse(env, base)) - char c[15 + strlen(base->name)]; - sprintf(c, "@Foreach:[%s]", base->name); + const m_str basename = type2str(env->gwion, base, stmt->exp->pos); + char c[15 + strlen(basename)]; + sprintf(c, "@Foreach:[%s]", basename); const Type ret = str2type(env->gwion, c, stmt->exp->pos); if(base->array_depth) set_tflag(ret, tflag_typedef);