.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / simple / testdata / src / CheckAssertNotNil / LintAssertNotNil.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/simple/testdata/src/CheckAssertNotNil/LintAssertNotNil.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/simple/testdata/src/CheckAssertNotNil/LintAssertNotNil.go
new file mode 100644 (file)
index 0000000..f15d084
--- /dev/null
@@ -0,0 +1,39 @@
+package pkg
+
+func fn(i interface{}, x interface{}) {
+       if _, ok := i.(string); ok && i != nil { // want `when ok is true, i can't be nil`
+       }
+       if _, ok := i.(string); i != nil && ok { // want `when ok is true, i can't be nil`
+       }
+       if _, ok := i.(string); i != nil || ok {
+       }
+       if _, ok := i.(string); i != nil && !ok {
+       }
+       if _, ok := i.(string); i == nil && ok {
+       }
+       if i != nil {
+               if _, ok := i.(string); ok { // want `when ok is true, i can't be nil`
+               }
+       }
+       if i != nil {
+               if _, ok := i.(string); ok {
+               }
+               println(i)
+       }
+       if i == nil {
+               if _, ok := i.(string); ok {
+               }
+       }
+       if i != nil {
+               if _, ok := i.(string); !ok {
+               }
+       }
+       if x != nil {
+               if _, ok := i.(string); ok {
+               }
+       }
+       if i != nil {
+               if _, ok := x.(string); ok {
+               }
+       }
+}