From ff6e0df0a58972bd6919b39f38905b9671f5ac31 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 7 Aug 2019 12:57:07 +0200 Subject: [PATCH] array: minor fixes --- compiler/fn.v | 4 ++-- vlib/builtin/array_test.v | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/fn.v b/compiler/fn.v index 5953d4804e..df1702cb02 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -862,10 +862,10 @@ fn (p mut Parser) fn_call_args(f mut Fn) *Fn { // Reference // TODO ptr hacks. DOOM hacks, fix please. if !got.contains('*') && expected.contains('*') && got != 'voidptr' { - // Special case for mutable arrays. We can't & function results, + // Special case for mutable arrays. We can't `&` function results, // have to use `(array[]){ expr }` hack. if expected.starts_with('array_') && expected.ends_with('*') { - p.cgen.set_placeholder(ph, '& /*111*/ (array_int[]){') + p.cgen.set_placeholder(ph, '& /*111*/ (array[]){') p.gen('} ') } // println('\ne:"$expected" got:"$got"') diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 2e9315b414..f3c524bbbe 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -183,9 +183,11 @@ fn modify (numbers mut []int) { } fn test_mut_slice() { - mut n := [1,2,3] - modify(mut n.left(2)) + mut n := [1,2,3] + modify(mut n.left(2)) assert n[0] == 777 - println(n) + modify(mut n.right(2)) + assert n[2] == 777 + println(n) }