• Robert Griesemer's avatar
    go/parser, go/types: report invalid else branch in if statements · 670642d3
    Robert Griesemer authored
    - Only accept valid if statement syntax in go/parser.
    
    - Check AST again in go/types since it may have been modified and the
      AST doesn't preclude other statements in the else branch of an if
      statement.
    
    - Removed a test from gofmt which verified that old-style if statements
      permitting any statement in the else branch were correctly reformatted.
      It's been years since we switched to the current syntax; no need to
      support this anymore.
    
    - Added a comment to go/printer.
    
    Fixes #13475.
    
    Change-Id: Id2c8fbcc68b719cd511027d0412a37266cceed6b
    Reviewed-on: https://go-review.googlesource.com/17408Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    670642d3
Name
Last commit
Last update
..
testdata Loading commit data...
doc.go Loading commit data...
gofmt.go Loading commit data...
gofmt_test.go Loading commit data...
internal.go Loading commit data...
long_test.go Loading commit data...
rewrite.go Loading commit data...
simplify.go Loading commit data...