From: Cuong Manh Le Date: Fri, 1 Nov 2019 02:13:40 +0000 (+0700) Subject: cmd/compile: revert change to "bound" in typecheckarraylit X-Git-Tag: go1.14beta1~464 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=130f3c061765f4f22da23ebf2fd4f7d0b137d826;p=gostls13.git cmd/compile: revert change to "bound" in typecheckarraylit 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 TryBot-Result: Gobot Gobot Reviewed-by: Matthew Dempsky --- diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 7fb4a51817..7b851d3d08 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -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)