Debian Codegraph @

_test/issue-1163.go

raw symbols SCIP
1 package main
2
3 import "fmt"
4
5 type WidgetEvent struct {
6 Nothing string
7 }
8
9 type WidgetControl interface {
10 HandleEvent(e *WidgetEvent)
11 }
12
13 type Button struct{}
14
15 func (b *Button) HandleEvent(e *WidgetEvent) {
16 }
17
18 type WindowEvent struct {
19 Something int
20 }
21
22 type Window struct {
23 Widget WidgetControl
24 }
25
26 func (w *Window) HandleEvent(e *WindowEvent) {
27 }
28
29 func main() {
30 window := &Window{
31 Widget: &Button{},
32 }
33 windowevent := &WindowEvent{}
34 // The next line uses the signature from the wrong method, resulting in an error.
35 // Renaming one of the clashing method names fixes the problem.
36 window.HandleEvent(windowevent)
37 fmt.Println("OK!")
38 }
39
40 // Output:
41 // OK!