@@ -70,6 +70,11 @@ fn (mut app App) type_decl(spec TypeSpec) {
7070 // Store alias info
7171 app.struct_or_alias << name
7272 app.struct_or_alias << v_name
73+ // Track if this is an array type alias
74+ if spec.typ is ArrayType {
75+ app.array_type_aliases[name] = true
76+ app.array_type_aliases[v_name] = true
77+ }
7378 // If this type will become an enum (detected by pre-scan), skip the type alias
7479 if name in app.enum_types {
7580 app.type_decl_name = name
@@ -362,6 +367,7 @@ fn (mut app App) struct_decl(struct_name string, spec StructType) {
362367 app.genln ('${pub_prefix }struct ${v_struct_name } {' )
363368
364369 // First output embedded structs (fields without names)
370+ mut has_pub_mut := false
365371 for field in spec.fields.list {
366372 if field.names.len == 0 {
367373 // Embedded struct - skip if it's a pointer type (V doesn't support embedded pointers)
@@ -375,7 +381,10 @@ fn (mut app App) struct_decl(struct_name string, spec StructType) {
375381 conversion := go2v_type_checked (ident.name)
376382 if conversion.is_basic {
377383 // Primitive type - generate as a named field
378- app.genln ('pub mut:' )
384+ if ! has_pub_mut {
385+ app.genln ('pub mut:' )
386+ has_pub_mut = true
387+ }
379388 app.genln ('\t ${ident .name .camel_to_snake ()} ${conversion .v_type }' )
380389 continue
381390 }
@@ -396,7 +405,7 @@ fn (mut app App) struct_decl(struct_name string, spec StructType) {
396405 break
397406 }
398407 }
399- if has_named_fields {
408+ if has_named_fields && ! has_pub_mut {
400409 app.genln ('pub mut:' )
401410 }
402411 for field in spec.fields.list {
@@ -466,7 +475,20 @@ fn (mut app App) composite_lit(c CompositeLit) {
466475 app.composite_lit (c)
467476 }
468477 Ident {
469- app.struct_init (c)
478+ // Check if this is an array type alias
479+ if c.typ.name in app.array_type_aliases {
480+ // Generate array literal: [elem1, elem2, ...]
481+ app.gen ('[' )
482+ for i, elt in c.elts {
483+ if i > 0 {
484+ app.gen (', ' )
485+ }
486+ app.expr (elt)
487+ }
488+ app.gen (']' )
489+ } else {
490+ app.struct_init (c)
491+ }
470492 }
471493 InvalidExpr {
472494 if c.elts.len > 0 {
0 commit comments