Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / go / analysis / passes / nilfunc / testdata / src / a / a.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/go/analysis/passes/nilfunc/testdata/src/a/a.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/go/analysis/passes/nilfunc/testdata/src/a/a.go
new file mode 100644 (file)
index 0000000..496009c
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+func F() {}
+
+type T struct {
+       F func()
+}
+
+func (T) M() {}
+
+var Fv = F
+
+func Comparison() {
+       var t T
+       var fn func()
+       if fn == nil || Fv == nil || t.F == nil {
+               // no error; these func vars or fields may be nil
+       }
+       if F == nil { // want "comparison of function F == nil is always false"
+               panic("can't happen")
+       }
+       if t.M == nil { // want "comparison of function M == nil is always false"
+               panic("can't happen")
+       }
+       if F != nil { // want "comparison of function F != nil is always true"
+               if t.M != nil { // want "comparison of function M != nil is always true"
+                       return
+               }
+       }
+       panic("can't happen")
+}