From c2defa4b42874b14314cfc08be48d210c04839c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 30 Nov 2019 22:59:15 +0100 Subject: [PATCH] :bug: Fix tuple cast --- src/emit/emit.c | 2 -- src/lib/tuple.c | 2 +- tests/range/range_no_match.gw | 2 ++ tests/tree/set_obj.gw | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 tests/range/range_no_match.gw create mode 100644 tests/tree/set_obj.gw 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); -- 2.43.0