Source file
test/fixedbugs/issue75063.go
1
2
3
4
5
6
7 package reorder
8
9 type Element struct {
10 A string
11 B string
12 C string
13 D string
14 E string
15 Text []string
16 List []string
17 Child Elements
18 F string
19 G bool
20 H bool
21 I string
22 }
23
24 type Elements []Element
25
26 func DoesNotCompile(ve Elements) Elements {
27 aa := Elements{}
28 bb := Elements{}
29 cc := Elements{}
30 dd := Elements{}
31 ee := Elements{}
32 ff := Elements{}
33 gg := Elements{}
34 hh := Elements{}
35 ii := Elements{}
36
37 if len(ve) != 1 {
38 return ve
39 }
40 for _, e := range ve[0].Child {
41 if len(e.Text) == 1 && (e.Text[0] == "xx") {
42 ee = append(ee, e)
43 } else if len(e.Text) == 1 && e.Text[0] == "yy" {
44 for _, c := range e.Child {
45 if len(c.Text) == 1 && c.Text[0] == "zz" {
46 ii = append(ii, c)
47 } else {
48 hh = append(hh, c)
49 }
50 }
51 ii = append(ii, hh...)
52 e.Child = ii
53 gg = append(gg, e)
54 } else if len(e.Text) == 1 && e.Text[0] == "tt" {
55 for _, entry := range e.Child {
56 for _, c := range entry.Child {
57 if len(c.Text) == 1 && c.Text[0] == "ee" {
58 cc = append(cc, c)
59 } else {
60 dd = append(dd, c)
61 }
62 }
63 cc = append(cc, dd...)
64 entry.Child = cc
65 bb = append(bb, entry)
66 cc, dd = Elements{}, Elements{}
67 }
68 e.Child = bb
69 aa = append(aa, e)
70 } else {
71 ff = append(ff, e)
72 }
73 }
74 return ve
75 }
76
View as plain text