From: George Barrett Date: Tue, 12 Dec 2017 03:39:33 +0000 (+1100) Subject: codegen: Infer index type of foreach on array from ArrayType.length_type X-Git-Tag: 0.43.1~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=597f95c3a7b92f42677904828c100b202c3dd2ee;p=thirdparty%2Fvala.git codegen: Infer index type of foreach on array from ArrayType.length_type https://gitlab.gnome.org/GNOME/vala/issues/607 --- diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala index 1936d512d..58e51d99f 100644 --- a/codegen/valaccodecontrolflowmodule.vala +++ b/codegen/valaccodecontrolflowmodule.vala @@ -247,7 +247,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule { // store array length for use by _vala_array_free ccode.add_assignment (get_variable_cexpression (get_array_length_cname (get_local_cname (collection_backup), 1)), array_len); - var iterator_variable = new LocalVariable (int_type.copy (), stmt.variable_name + "_it"); + var iterator_variable = new LocalVariable (array_type.length_type.copy (), stmt.variable_name + "_it"); visit_local_variable (iterator_variable); var it_name = get_local_cname (iterator_variable);