• Robert Griesemer's avatar
    spec: clarify variable declaration type rules · 47094dcf
    Robert Griesemer authored
    Not a language change.
    
    Several inaccuracies were fixed:
    
    1) A variable declaration may declare more than just one
    variable.
    
    2) Variable initialization follows the rules of assignments,
    including n:1 assignments. The existing wording implied a 1:1
    or n:n rule and generally was somewhat unspecific.
    
    3) The rules for variable declarations with no types and
    untyped initialization expressions had minor holes (issue 8088).
    
    4) Clarified the special cases of assignments of untyped values
    (we don't just have untyped constants, but also untyped bools,
    e.g. from comparisons). The new wording is more direct.
    
    To that end, introduced the notion of an untyped constant's
    "default type" so that the same concept doesn't have to be
    repeatedly introduced.
    
    Fixes #8088.
    
    LGTM=iant, r, rsc
    R=r, rsc, iant, ken
    CC=golang-codereviews
    https://golang.org/cl/142320043
    47094dcf
go_spec.html 188 KB