• acanino's avatar
    cmd/compile: "invalid variable name x in type switch", where x is a name of a constant · b60c8203
    acanino authored
    Small fix: looks like a short variable declaration with a type switch
    checks to make sure the variable used had valid shape (ONAME, OTYPE, or
    ONONAME) and rejects everything else. Then a new variable is declared.
    If the symbol contained in the declaration was a named OLITERAL (still a
    valid identifier obviously) it would be rejected, even though a new
    variable would have been declared.
    
    Fix adds this case to the check.
    
    Added a test case from issue12413.
    
    Fixes #12413
    
    Change-Id: I150dadafa8ee5612c867d58031027f2dca8c6ebc
    Reviewed-on: https://go-review.googlesource.com/15760Reviewed-by: 's avatarMinux Ma <minux@golang.org>
    Run-TryBot: Minux Ma <minux@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    b60c8203