File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
tests/aliases/modules/value Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
5252 g.write (g.type_default_sumtype (unwrapped_typ, sym))
5353 }
5454 return
55- } else if sym.kind == .map {
55+ } else if sym.kind == .map || (sym. kind == .array && node.init_fields. len == 0 ) {
5656 g.write (g.type_default (unwrapped_typ))
5757 return
5858 }
Original file line number Diff line number Diff line change 1+ module value
2+
3+ pub interface Value {
4+ str () string
5+ }
6+
7+ pub type List = []Value
8+
9+ pub fn (x List) str () string {
10+ return x.str ()
11+ }
Original file line number Diff line number Diff line change 1+ module value
2+
3+ fn test_list () {
4+ mut list := make_list ()!
5+ assert (list as List ).len == 0
6+ }
7+
8+ fn make_list () ! Value {
9+ mut list := List{}
10+ return list
11+ }
You can’t perform that action at this time.
0 commit comments