Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201028153306-37f0764111ff / refactor / eg / testdata / C1.golden
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/refactor/eg/testdata/C1.golden b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/refactor/eg/testdata/C1.golden
new file mode 100644 (file)
index 0000000..ae7759d
--- /dev/null
@@ -0,0 +1,22 @@
+// +build ignore
+
+package C1
+
+import "strings"
+
+func example() {
+       x := "foo"
+       println(x)
+
+       // Match, but the transformation is not sound w.r.t. possible side effects.
+       println(strings.Repeat("*", 3))
+
+       // No match, since second use of wildcard doesn't match first.
+       println(strings.Repeat("*", 3)[:len(strings.Repeat("*", 2))])
+
+       // Recursive match demonstrating bottom-up rewrite:
+       // only after the inner replacement occurs does the outer syntax match.
+       println(x)
+       // -> (x[:len(x)])
+       // -> x
+}