Debian Codegraph @

_test/nil3.go

raw symbols SCIP
1 package main
2
3 type I interface {
4 Hello()
5 }
6
7 type T struct {
8 h I
9 }
10
11 func (t *T) Hello() { println("Hello") }
12
13 func main() {
14 t := &T{}
15 println(t.h != nil)
16 println(t.h == nil)
17 t.h = t
18 println(t.h != nil)
19 println(t.h == nil)
20 t.h.Hello()
21 }
22
23 // Output:
24 // false
25 // true
26 // true
27 // false
28 // Hello