GoPLS Viewer

Home|gopls/refactor/eg/testdata/C1.golden
1package C1
2
3import "strings"
4
5func example() {
6    x := "foo"
7    println(x)
8
9    // Match, but the transformation is not sound w.r.t. possible side effects.
10    println(strings.Repeat("*", 3))
11
12    // No match, since second use of wildcard doesn't match first.
13    println(strings.Repeat("*", 3)[:len(strings.Repeat("*", 2))])
14
15    // Recursive match demonstrating bottom-up rewrite:
16    // only after the inner replacement occurs does the outer syntax match.
17    println(x)
18    // -> (x[:len(x)])
19    // -> x
20}
21
MembersX
Members
X