The receive operator was given incorrect precedence
resulting in incorrect deletion of parentheses.
Fixes #3843.
R=rsc
CC=golang-dev, remy
https://golang.org/cl/
6442049
[OPAREN] = 8,
[OPRINTN] = 8,
[OPRINT] = 8,
- [ORECV] = 8,
[ORUNESTR] = 8,
[OSTRARRAYBYTE] = 8,
[OSTRARRAYRUNE] = 8,
[OMINUS] = 7,
[OADDR] = 7,
[OIND] = 7,
+ [ORECV] = 7,
[OMUL] = 6,
[ODIV] = 6,
--- /dev/null
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package pkg1
+
+var x = make(chan interface{})
+
+func Do() int {
+ return (<-x).(int)
+}
--- /dev/null
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 3843: inlining bug due to wrong receive operator precedence.
+
+package pkg2
+
+import "./pkg1"
+
+func F() {
+ pkg1.Do()
+}
+
--- /dev/null
+// compiledir
+
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ignored