• 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
..
comments.golden Loading commit data...
comments.input Loading commit data...
composites.golden Loading commit data...
composites.input Loading commit data...
crlf.golden Loading commit data...
crlf.input Loading commit data...
emptydecl.golden Loading commit data...
emptydecl.input Loading commit data...
import.golden Loading commit data...
import.input Loading commit data...
ranges.golden Loading commit data...
ranges.input Loading commit data...
rewrite1.golden Loading commit data...
rewrite1.input Loading commit data...
rewrite2.golden Loading commit data...
rewrite2.input Loading commit data...
rewrite3.golden Loading commit data...
rewrite3.input Loading commit data...
rewrite4.golden Loading commit data...
rewrite4.input Loading commit data...
rewrite5.golden Loading commit data...
rewrite5.input Loading commit data...
rewrite6.golden Loading commit data...
rewrite6.input Loading commit data...
rewrite7.golden Loading commit data...
rewrite7.input Loading commit data...
rewrite8.golden Loading commit data...
rewrite8.input Loading commit data...
slices1.golden Loading commit data...
slices1.input Loading commit data...
slices2.golden Loading commit data...
slices2.input Loading commit data...
stdin1.golden Loading commit data...
stdin1.input Loading commit data...
stdin2.golden Loading commit data...
stdin2.input Loading commit data...
stdin3.golden Loading commit data...
stdin3.input Loading commit data...
stdin4.golden Loading commit data...
stdin4.input Loading commit data...
stdin5.golden Loading commit data...
stdin5.input Loading commit data...
stdin6.golden Loading commit data...
stdin6.input Loading commit data...
stdin7.golden Loading commit data...
stdin7.input Loading commit data...
typeswitch.golden Loading commit data...
typeswitch.input Loading commit data...