File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -966,7 +966,11 @@ pub fn (t &Table) array_name(elem_type Type) string {
966966 ptr := if elem_type.is_ptr () { '&' .repeat (elem_type.nr_muls ()) } else { '' }
967967 opt := if elem_type.has_flag (.option) { '?' } else { '' }
968968 res := if elem_type.has_flag (.result) { '!' } else { '' }
969- return '[]${opt }${res }${ptr }${elem_type_sym .name }'
969+ mut name := elem_type_sym.name
970+ if elem_type_sym.info is Struct && elem_type_sym.info.scoped_name != '' {
971+ name = elem_type_sym.info.scoped_name
972+ }
973+ return '[]${opt }${res }${ptr }${name }'
970974}
971975
972976@[inline]
Original file line number Diff line number Diff line change 1+ module main
2+
3+ fn test_a () {
4+ struct Ak {
5+ a int
6+ b int
7+ }
8+
9+ cases := [
10+ Ak{1 , 1 },
11+ Ak{2 , 2 },
12+ ]
13+ for _, k in cases {
14+ assert k.a == k.b
15+ }
16+ }
17+
18+ fn test_b () {
19+ struct Ak {
20+ a int
21+ b int
22+ c int
23+ }
24+
25+ cases := [
26+ Ak{1 , 2 , 2 },
27+ Ak{2 , 2 , 2 },
28+ ]
29+ for _, k in cases {
30+ assert k.b == k.c
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments