• Matthew Dempsky's avatar
    cmd/compile: simplify OPTRLIT handling · 00b773a4
    Matthew Dempsky authored
    Previously, we would recognize &(T{...}) expressions during type
    checking, rewrite them into (*T){...}, and then do a lot of extra work
    to make sure the user doesn't write (*T){...} themselves and
    resynthesizing the OPTRLIT later on.
    
    This CL simply handles &T{...} directly in the straight forward
    manner, by changing OADDR directly to OPTRLIT when appropriate.
    
    While here, match go/types's invalid composite literal type error
    message.
    
    Passes toolstash-check.
    
    Change-Id: I902b14c7e2cd9fa93e6915dd58272d2352ba38f8
    Reviewed-on: https://go-review.googlesource.com/c/go/+/197120
    Run-TryBot: Matthew Dempsky <mdempsky@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
    00b773a4
noder.go 37.5 KB