From: Jérémie Astor Date: Sat, 30 Nov 2019 21:59:15 +0000 (+0100) Subject: :bug: Fix tuple cast X-Git-Tag: nightly~2070^2~14 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=c2defa4b42874b14314cfc08be48d210c04839c1;p=gwion.git :bug: Fix tuple cast --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 22806b94..f5448f18 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -159,8 +159,6 @@ ANN static void emit_pre_ctor(const Emitter emit, const Type type) { maybe_ctor(emit, type); if(GET_FLAG(type, typedef) && type->e->parent->array_depth) emit_array_extend(emit, type->e->parent, type->e->def->base.ext->array->exp); - if(GET_FLAG(type, template) && GET_FLAG(type, builtin)) - tmpl_ctor(emit, type); } #define regxxx(name, instr) \ diff --git a/src/lib/tuple.c b/src/lib/tuple.c index 4e6115b5..9edc94bb 100644 --- a/src/lib/tuple.c +++ b/src/lib/tuple.c @@ -167,7 +167,7 @@ static OP_CHECK(opck_at_tuple_object) { static OP_CHECK(opck_cast_tuple_object) { const Exp_Cast *cast = (Exp_Cast*)data; - if(tuple_match(env, exp_self(cast)->type, cast->exp->type) < 0) + if(tuple_match(env, cast->exp->type, exp_self(cast)->type) < 0) return env->gwion->type[et_null]; return exp_self(cast)->type; } diff --git a/tests/range/range_no_match.gw b/tests/range/range_no_match.gw new file mode 100644 index 00000000..091c0104 --- /dev/null +++ b/tests/range/range_no_match.gw @@ -0,0 +1,2 @@ +#! [contains] range types do not match +[1:1,2]; diff --git a/tests/tree/set_obj.gw b/tests/tree/set_obj.gw new file mode 100644 index 00000000..7796e2e6 --- /dev/null +++ b/tests/tree/set_obj.gw @@ -0,0 +1,5 @@ +typedef int[2]Type; +Type!type; +<<>>; +for(auto@a:type); +#!for(auto a:type);