diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index b1b6f65ae7..8883844415 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -685,7 +685,7 @@ fn (g mut Gen) expr(node ast.Expr) { receiver_name = typ_sym.name if typ_sym.kind == .array && it.name in // TODO performance, detect `array` method differently - ['repeat', 'sort_with_compare', 'free', 'push_many', 'trim'] { + ['repeat', 'sort_with_compare', 'free', 'push_many', 'trim', 'first', 'clone'] { // && rec_sym.name == 'array' { // && rec_sym.name == 'array' && receiver_name.starts_with('array') { // `array_byte_clone` => `array_clone` diff --git a/vlib/v/gen/tests/1.c b/vlib/v/gen/tests/1.c index 0b48e2087e..8809186bab 100644 --- a/vlib/v/gen/tests/1.c +++ b/vlib/v/gen/tests/1.c @@ -56,7 +56,7 @@ int main() { Color color = Color_red; localmod__pub_foo(); int ten = localmod__get_int_10(); - println(localmod__pub_int_const); + println(int_str(localmod__pub_int_const)); int g = ((int)(3.0)); byte* bytes = ((byte*)(0)); User user_ptr = (User*)memdup(&(User){}, sizeof(User)); @@ -96,6 +96,7 @@ i < 10; i++) { bool b2 = (*(bool*)array_get(bools, 0)) || true; bool b3 = get_bool() || true; int f = array_first(nums); + array_int c = array_clone(nums); string d = tos3("d"); println(string_add(s, d)); } diff --git a/vlib/v/gen/tests/1.vv b/vlib/v/gen/tests/1.vv index 0aabba38da..e31302772c 100644 --- a/vlib/v/gen/tests/1.vv +++ b/vlib/v/gen/tests/1.vv @@ -81,6 +81,7 @@ fn foo(a int) { b2 := bools[0] || true b3 := get_bool() || true f := nums.first() + c := nums.clone() d := 'd' println(s + d) //cloned = nums.clone()