diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index c622d88ff7..911717327e 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -979,7 +979,7 @@ fn (mut f Fmt) array_init(it ast.ArrayInit) { f.expr(it.cap_expr) } if it.has_default { - f.write('default: ') + f.write('init: ') f.expr(it.default_expr) } f.write('}') @@ -1003,7 +1003,7 @@ fn (mut f Fmt) array_init(it ast.ArrayInit) { } } if it.has_default { - f.write('default: ') + f.write('init: ') f.expr(it.default_expr) } f.write('}') diff --git a/vlib/v/fmt/tests/array_newlines_keep.vv b/vlib/v/fmt/tests/array_newlines_keep.vv index 93cd90a8ed..7ae0d9d648 100644 --- a/vlib/v/fmt/tests/array_newlines_keep.vv +++ b/vlib/v/fmt/tests/array_newlines_keep.vv @@ -9,6 +9,6 @@ fn main() { make_flag('darwin', '-framework', 'Cocoa'), make_flag('windows', '-l', 'gdi32') ] - x := []int{len: 10, cap: 100, default: 1} + x := []int{len: 10, cap: 100, init: 1} _ := expected_flags } diff --git a/vlib/v/parser/containers.v b/vlib/v/parser/containers.v index 7a7809bcbe..238c2deb4e 100644 --- a/vlib/v/parser/containers.v +++ b/vlib/v/parser/containers.v @@ -91,12 +91,12 @@ fn (mut p Parser) array_init() ast.ArrayInit { has_cap = true cap_expr = p.expr(0) } - 'default' { + 'init' { has_default = true default_expr = p.expr(0) } else { - p.error('wrong field `$key`, expecting `len`, `cap`, or `default`') + p.error('wrong field `$key`, expecting `len`, `cap`, or `init`') } } if p.tok.kind != .rcbr {