| 1 |
//gofmt -r=x+x->2*x |
| 2 |
|
| 3 |
// Copyright 2011 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Rewriting of expressions containing nodes with associated comments to |
| 8 |
// expressions without those nodes must also eliminate the associated |
| 9 |
// comments. |
| 10 |
|
| 11 |
package p |
| 12 |
|
| 13 |
func f(x int) int { |
| 14 |
_ = x + x // this comment remains in the rewrite |
| 15 |
_ = x /* this comment must not be in the rewrite */ + x |
| 16 |
return x /* this comment must not be in the rewrite */ + x |
| 17 |
} |