.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / simple / testdata / src / CheckSimplifyTypeSwitch / LintSimplifyTypeSwitch.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/simple/testdata/src/CheckSimplifyTypeSwitch/LintSimplifyTypeSwitch.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/simple/testdata/src/CheckSimplifyTypeSwitch/LintSimplifyTypeSwitch.go
new file mode 100644 (file)
index 0000000..892f844
--- /dev/null
@@ -0,0 +1,33 @@
+package pkg
+
+import "fmt"
+
+func gen() interface{} { return nil }
+
+func fn(x, y interface{}) {
+       switch z := x.(type) {
+       case int:
+               _ = z
+               fmt.Println(x.(int))
+       }
+       switch x.(type) {
+       case int:
+               fmt.Println(x.(int), y.(int))
+       }
+       switch x.(type) { // want `assigning the result of this type assertion`
+       case int:
+               fmt.Println(x.(int))
+       }
+       switch x.(type) {
+       case int:
+               fmt.Println(x.(string))
+       }
+       switch x.(type) {
+       case int:
+               fmt.Println(y.(int))
+       }
+       switch (gen()).(type) {
+       case int:
+               fmt.Println((gen()).(int))
+       }
+}