]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: revert change to "bound" in typecheckarraylit
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 1 Nov 2019 02:13:40 +0000 (09:13 +0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 1 Nov 2019 22:04:05 +0000 (22:04 +0000)
In CL 204617, I intend to make "bound" parameter to have special meaning
in typecheckarraylit, so we can distinguish between type-checks array
literal and slice literal. But we end up with other solution. The CL was
submitted without reverting the "bound" parameter in case of slice
literal.

Technically, it's not harmful, but causes the code harder to read and maintain.

Change-Id: Ia522ccc9a6b8e25d7eaad4aa4957cb4fa18edc60
Reviewed-on: https://go-review.googlesource.com/c/go/+/204618
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/typecheck.go

index 7fb4a518177f393b07a89af83d0a447215ec7629..7b851d3d086e894573cc5b4918b9217f547fd668 100644 (file)
@@ -2809,7 +2809,7 @@ func typecheckcomplit(n *Node) (res *Node) {
                n.Right = nil
 
        case TSLICE:
-               length := typecheckarraylit(t.Elem(), -2, n.List.Slice(), "slice literal")
+               length := typecheckarraylit(t.Elem(), -1, n.List.Slice(), "slice literal")
                n.Op = OSLICELIT
                n.Right = nodintconst(length)