]> Nishi Git Mirror - gwion.git/commitdiff
:bug: Fix tuple cast
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Sat, 30 Nov 2019 21:59:15 +0000 (22:59 +0100)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Sat, 30 Nov 2019 21:59:15 +0000 (22:59 +0100)
src/emit/emit.c
src/lib/tuple.c
tests/range/range_no_match.gw [new file with mode: 0644]
tests/tree/set_obj.gw [new file with mode: 0644]

index 22806b9481fdec0419c64f1fba25ecf722df5a5e..f5448f18b5eda0f36e3cbdda4fd58fc2dc82c895 100644 (file)
@@ -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) \
index 4e6115b5c7eafb401f9d763d727f45bf38d03655..9edc94bba52615d186e584669c92b3b4f9613514 100644 (file)
@@ -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 (file)
index 0000000..091c010
--- /dev/null
@@ -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 (file)
index 0000000..7796e2e
--- /dev/null
@@ -0,0 +1,5 @@
+typedef int[2]Type;
+Type!type;
+<<<type>>>;
+for(auto@a:type);
+#!for(auto a:type);