github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/cmd/gofmt/testdata/rewrite4.golden (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Rewriting of parenthesized expressions (x) -> x 6 // must not drop parentheses if that would lead to 7 // wrong association of the operands. 8 // Was issue 1847. 9 10 package main 11 12 // From example 1 of issue 1847. 13 func _() { 14 var t = (&T{1000}).Id() 15 } 16 17 // From example 2 of issue 1847. 18 func _() { 19 fmt.Println((*xpp).a) 20 } 21 22 // Some more test cases. 23 func _() { 24 _ = (-x).f 25 _ = (*x).f 26 _ = (&x).f 27 _ = (!x).f 28 _ = -x.f 29 _ = *x.f 30 _ = &x.f 31 _ = !x.f 32 (-x).f() 33 (*x).f() 34 (&x).f() 35 (!x).f() 36 _ = -x.f() 37 _ = *x.f() 38 _ = &x.f() 39 _ = !x.f() 40 41 _ = (-x).f 42 _ = (*x).f 43 _ = (&x).f 44 _ = (!x).f 45 _ = -x.f 46 _ = *x.f 47 _ = &x.f 48 _ = !x.f 49 (-x).f() 50 (*x).f() 51 (&x).f() 52 (!x).f() 53 _ = -x.f() 54 _ = *x.f() 55 _ = &x.f() 56 _ = !x.f() 57 58 _ = -x.f 59 _ = *x.f 60 _ = &x.f 61 _ = !x.f 62 _ = -x.f 63 _ = *x.f 64 _ = &x.f 65 _ = !x.f 66 _ = -x.f() 67 _ = *x.f() 68 _ = &x.f() 69 _ = !x.f() 70 _ = -x.f() 71 _ = *x.f() 72 _ = &x.f() 73 _ = !x.f() 74 }