From d0556a8a313499d2c18daa1e1275241809bed076 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 9 Feb 2021 13:30:48 +0100 Subject: [PATCH] :bug: Fix foreach in the case of an inner type --- src/parse/check.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- 2.43.0