Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / staticcheck / testdata / src / CheckRepeatedIfElse / CheckRepeatedIfElse.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/staticcheck/testdata/src/CheckRepeatedIfElse/CheckRepeatedIfElse.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/staticcheck/testdata/src/CheckRepeatedIfElse/CheckRepeatedIfElse.go
new file mode 100644 (file)
index 0000000..0d966a6
--- /dev/null
@@ -0,0 +1,55 @@
+package pkg
+
+func fn1(b1, b2 bool) {
+       if b1 && !b2 {
+       } else if b1 {
+       } else if b1 && !b2 { // want `condition occurs multiple times`
+       } else if b1 { // want `condition occurs multiple times`
+       } else {
+               println()
+       }
+}
+
+func fn2(b1, b2 bool, ch chan string) {
+       if b1 && !b2 {
+       } else if b1 {
+       } else if <-ch == "" {
+       } else if <-ch == "" {
+       } else {
+               println()
+       }
+}
+
+func fn3() {
+       if gen() {
+               println()
+       } else if gen() {
+               println()
+       }
+}
+
+func fn4() {
+       if s := gen2(); s == "" {
+       } else if s := gen2(); s == "" {
+               println()
+       }
+}
+
+func fn5() {
+       var s string
+       if s = gen2(); s == "" {
+       } else if s != "foo" {
+       } else if s = gen2(); s == "" {
+       } else if s != "foo" {
+               println()
+       }
+}
+
+func fn6() {
+       if true {
+       } else {
+       }
+}
+
+func gen() bool    { return false }
+func gen2() string { return "" }