Source file
test/fixedbugs/issue45851.go
1
2
3
4
5
6
7
8
9
10
11
12
13 package main
14
15 import "fmt"
16
17 type Kind uint16
18 type Flag uint16
19
20 const (
21 allKinds Kind = 1
22 TopKind Kind = (allKinds - 1)
23 )
24 type Value interface {
25 Kind() Kind
26 }
27 type Vertex struct {
28 BaseValue Value
29 name string
30 }
31 func (v *Vertex) Kind() Kind {
32 return TopKind
33 }
34
35 func main() {
36 vA := &Vertex{name:"vA",}
37 vB := &Vertex{name:"vB",}
38 vX := &Vertex{name:"vX",}
39 vA.BaseValue = vX
40 vB.BaseValue = vX
41 _ = equalVertex(vA, vB, Flag(1))
42 }
43
44 var foo string
45
46
47 func (v *Vertex) IsClosedStruct() bool {
48 return true
49 }
50
51 func equalVertex(x *Vertex, v Value, flags Flag) bool {
52 y, ok := v.(*Vertex)
53 if !ok {
54 return false
55 }
56 v, ok1 := x.BaseValue.(Value)
57 w, ok2 := y.BaseValue.(Value)
58 if !ok1 && !ok2 {
59 return true
60 }
61 return equalTerminal(v, w, flags)
62 }
63
64
65 func equalTerminal(x Value, y Value, flags Flag) bool {
66 foo = fmt.Sprintf("EQclosed %s %s %d\n", x.(*Vertex).name, y.(*Vertex).name, flags)
67 return true
68 }
69
View as plain text