New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go/printer: does not always insert required parens around &x and *x #1847
Labels
Milestone
Comments
ASTs before and after rewrite: { 168 . . . . . . . . . . . . X: *ast.ParenExpr { 169 . . . . . . . . . . . . . Lparen: test.go:12:10 170 . . . . . . . . . . . . . X: *ast.UnaryExpr { 171 . . . . . . . . . . . . . . OpPos: test.go:12:11 172 . . . . . . . . . . . . . . Op: & 173 . . . . . . . . . . . . . . X: *ast.CompositeLit { 174 . . . . . . . . . . . . . . . Type: *ast.Ident { 175 . . . . . . . . . . . . . . . . NamePos: test.go:12:12 176 . . . . . . . . . . . . . . . . Name: "T" 177 . . . . . . . . . . . . . . . . Obj: *(obj @ 16) 178 . . . . . . . . . . . . . . . } 179 . . . . . . . . . . . . . . . Lbrace: test.go:12:13 180 . . . . . . . . . . . . . . . Elts: []ast.Expr (len = 1) { 181 . . . . . . . . . . . . . . . . 0: *ast.BasicLit { 182 . . . . . . . . . . . . . . . . . ValuePos: test.go:12:14 183 . . . . . . . . . . . . . . . . . Kind: INT 184 . . . . . . . . . . . . . . . . . Value: "1000" 185 . . . . . . . . . . . . . . . . } 186 . . . . . . . . . . . . . . . } 187 . . . . . . . . . . . . . . . Rbrace: test.go:12:18 188 . . . . . . . . . . . . . . } 189 . . . . . . . . . . . . . } 190 . . . . . . . . . . . . . Rparen: test.go:12:19 191 . . . . . . . . . . . . } 192 . . . . . . . . . . . . Sel: *ast.Ident { 193 . . . . . . . . . . . . . NamePos: test.go:12:21 194 . . . . . . . . . . . . . Name: "Id" 195 . . . . . . . . . . . . } 196 . . . . . . . . . . . } Owner changed to @griesemer. Status changed to Accepted. |
ASTs before and after rewrite: 165 . . . . . . . . . Values: []ast.Expr (len = 1) { 166 . . . . . . . . . . 0: *ast.CallExpr { 167 . . . . . . . . . . . Fun: *ast.SelectorExpr { 168 . . . . . . . . . . . . X: *ast.ParenExpr { 169 . . . . . . . . . . . . . Lparen: test.go:12:10 170 . . . . . . . . . . . . . X: *ast.UnaryExpr { 171 . . . . . . . . . . . . . . OpPos: test.go:12:11 172 . . . . . . . . . . . . . . Op: & 173 . . . . . . . . . . . . . . X: *ast.CompositeLit { 174 . . . . . . . . . . . . . . . Type: *ast.Ident { 175 . . . . . . . . . . . . . . . . NamePos: test.go:12:12 176 . . . . . . . . . . . . . . . . Name: "T" 177 . . . . . . . . . . . . . . . . Obj: *(obj @ 16) 178 . . . . . . . . . . . . . . . } 179 . . . . . . . . . . . . . . . Lbrace: test.go:12:13 180 . . . . . . . . . . . . . . . Elts: []ast.Expr (len = 1) { 181 . . . . . . . . . . . . . . . . 0: *ast.BasicLit { 182 . . . . . . . . . . . . . . . . . ValuePos: test.go:12:14 183 . . . . . . . . . . . . . . . . . Kind: INT 184 . . . . . . . . . . . . . . . . . Value: "1000" 185 . . . . . . . . . . . . . . . . } 186 . . . . . . . . . . . . . . . } 187 . . . . . . . . . . . . . . . Rbrace: test.go:12:18 188 . . . . . . . . . . . . . . } 189 . . . . . . . . . . . . . } 190 . . . . . . . . . . . . . Rparen: test.go:12:19 191 . . . . . . . . . . . . } 192 . . . . . . . . . . . . Sel: *ast.Ident { 193 . . . . . . . . . . . . . NamePos: test.go:12:21 194 . . . . . . . . . . . . . Name: "Id" 195 . . . . . . . . . . . . } 196 . . . . . . . . . . . } 197 . . . . . . . . . . . Lparen: test.go:12:23 198 . . . . . . . . . . . Ellipsis: - 199 . . . . . . . . . . . Rparen: test.go:12:24 200 . . . . . . . . . . } 201 . . . . . . . . . } 165 . . . . . . . . . Values: []ast.Expr (len = 1) { 166 . . . . . . . . . . 0: *ast.UnaryExpr { 167 . . . . . . . . . . . OpPos: <standard input>:12:10 168 . . . . . . . . . . . Op: & 169 . . . . . . . . . . . X: *ast.CallExpr { 170 . . . . . . . . . . . . Fun: *ast.SelectorExpr { 171 . . . . . . . . . . . . . X: *ast.CompositeLit { 172 . . . . . . . . . . . . . . Type: *ast.Ident { 173 . . . . . . . . . . . . . . . NamePos: <standard input>:12:11 174 . . . . . . . . . . . . . . . Name: "T" 175 . . . . . . . . . . . . . . . Obj: *(obj @ 16) 176 . . . . . . . . . . . . . . } 177 . . . . . . . . . . . . . . Lbrace: <standard input>:12:12 178 . . . . . . . . . . . . . . Elts: []ast.Expr (len = 1) { 179 . . . . . . . . . . . . . . . 0: *ast.BasicLit { 180 . . . . . . . . . . . . . . . . ValuePos: <standard input>:12:13 181 . . . . . . . . . . . . . . . . Kind: INT 182 . . . . . . . . . . . . . . . . Value: "1000" 183 . . . . . . . . . . . . . . . } 184 . . . . . . . . . . . . . . } 185 . . . . . . . . . . . . . . Rbrace: <standard input>:12:17 186 . . . . . . . . . . . . . } 187 . . . . . . . . . . . . . Sel: *ast.Ident { 188 . . . . . . . . . . . . . . NamePos: <standard input>:12:19 189 . . . . . . . . . . . . . . Name: "Id" 190 . . . . . . . . . . . . . } 191 . . . . . . . . . . . . } 192 . . . . . . . . . . . . Lparen: <standard input>:12:21 193 . . . . . . . . . . . . Ellipsis: - 194 . . . . . . . . . . . . Rparen: <standard input>:12:22 195 . . . . . . . . . . . } 196 . . . . . . . . . . } 197 . . . . . . . . . } |
Owner changed to builder@golang.org. |
Owner changed to @griesemer. |
This issue was closed by revision 47afa4d. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by qyzhai:
The text was updated successfully, but these errors were encountered: