Rewrite and simplify the rewriteMOV function in preparation for eliminating it
entirely. Improve some error messages in the process.
Change-Id: Id9a77be5174d46cc23651930c2e9068ee6555690
Reviewed-on: https://go-review.googlesource.com/c/go/+/344458
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
I was a little too agressive in CL 258957 (removing 387 support) in
removing a signaling NaN test that should probably still exist.
I should have just removed the 387 skip, not the entire test.
Change-Id: I97ca53f190eb0de00e43b96629b2cae677e7dacb
Reviewed-on: https://go-review.googlesource.com/c/go/+/348209
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: Ic3c69906a8afde63278f173df0427b1c460c9f3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/348189
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Added new function earlyTransformAssign() to add needed CONVIFACE nodes
due to assignments in generic functions.
Fixes#48049
Change-Id: I7cd9cee6ecf34ed2ef0743d1b17645b9f520fa00
Reviewed-on: https://go-review.googlesource.com/c/go/+/347914
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Update #40724
Change-Id: I110cdb7c4a2c5db6b85ca951143430555261abf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/348017
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This is easier to use in documentation.
Adjust the existing documentation that worked around the unfortunate name.
Change-Id: Ia4b7793ab94dfd7fb3968ee983be56cc38c30ec3
Reviewed-on: https://go-review.googlesource.com/c/go/+/347769
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This allows callers to do (amortized) allocation-free iteration
over many maps.
Fixes#46293
Change-Id: I3aa6134dd00da35b508bd1e3b487332a871a3673
Reviewed-on: https://go-review.googlesource.com/c/go/+/321891
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
We had code in NewPtr() to set the HasTParam/HasShape flag as needed for
the cached ptr element if it wasn't set correctly based on its Elem.
This was causing the race mentioned in the issue.
But that setting code is no longer needed, as long as we call
SetRParams() soon after calling NewIncompleteNamedType(), before
creating/translating the underlying type (which we do). The
HasTParam/HasShape attribute can only come from setting of rparams or a
direct typeparam/shape somewhere in the underlying type, both of which
don't depend on recursion, etc. (as long as the rparams are set early).
Added a check that HasTParam/HasShape are set correctly for the cached
pointer/slice elems in NewPtr() and NewSlice().
Fixes#48191
Change-Id: Ide7d82efb77ae97901e75b2e6c65bd1bfc25e0ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/348089
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
In CL 345572, we used the reflect.Value.SetLen method to avoid
extra memory allocation for reflect.Value.Slice.
This also applies to function decodeSlice
name old time/op new time/op delta
DecodeStringsSlice-12 96.5µs ±12% 63.0µs ± 8% -34.68% (p=0.000 n=9+10)
name old alloc/op new alloc/op delta
DecodeStringsSlice-12 89.3kB ± 0% 65.3kB ± 0% -26.89% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
DecodeStringsSlice-12 3.18k ± 0% 2.18k ± 0% -31.47% (p=0.000 n=10+10)
Change-Id: Ifdb43716cc90a265962dec022704a5571f447fd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/347533
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
We should be putting a newly instantiated imported type in
Instantiate/doInst onto the instTypeList, so its methods/dictionaries
are instantiated. To do this, we needed a more general way to add a
type to instTypeList, so add NeedInstType(), analogous to
NeedRuntimeType(). This has the extra advantage that now all types
created by the type substituter are added to instTypeList without any
extra code, which was easy to forget. doInst() now correctly calls
NeedInstType().
This is a bit aggressive, since a fully instantiated type in a generic
function/method may never be used, if the generic method is never
instantiated in the local package. But it should be fairly uncommon for
a generic method to mention a fully instantiated type (but it does
happen in this bug).
Fixes both cases mentioned in the bug.
Fixed#48185
Change-Id: I19b5012dfac17e306c8005f8595a648b0ab280d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/347909
Trust: Dan Scales <danscales@google.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
If the condition is a bool constant, there's no need to walk both
branches.
Passes toolstash -cmp.
Change-Id: I4ee5e3553ce07c2213efba0d33d869b4a1b57783
Reviewed-on: https://go-review.googlesource.com/c/go/+/347911
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
golang.org/cl/33572 added a map iterator.
use the reflect.Value.MapRange to fix map keys that contain a NaN
Fixes#24075
Change-Id: I0214d6f26c2041797703e48eac16404f189d6982
GitHub-Last-Rev: 5c01e117f4
GitHub-Pull-Request: golang/go#47476
Reviewed-on: https://go-review.googlesource.com/c/go/+/338609
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
We were missing copying the Funarg value when substituting for a struct
type.
Change-Id: Id0c2d9e55fb15987acb9edba6f74cf57cfd3417e
Reviewed-on: https://go-review.googlesource.com/c/go/+/347913
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Calling reader2.obj fully loads the referenced object, which is
necessary in general; but for reading the package index, we just need
to setup the name->index mapping. This CL adds this, so that lazy
loading works as intended.
Change-Id: Ie51d59e2247d99b46f9dc69fba7ce89e2584b7c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/348011
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This is a port of CL 347534 to go/types.
Change-Id: I2b15a29992c430e34592d110be16d7b2b10521a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/348029
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
For lazy import resolution, there's reentrancy issue with (*Named).load
method, when "t.resolve(t)" can lead us to the same named type, thus
(*Named).load is called recursively, causing the deadlock.
The main problem is that when instantinate a type, we calculate the type
hashing, including TParams. Calling t.TParams().Len() triggers the
reentrancy call to "(*Named).load".
To fix this, just not checking TParams().Len() if we are hashing.
Updates #48185
Change-Id: Ie34842d7b10fad5d11fbcf75bb1c64a89deac6b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/347534
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
According to the .debug_gdb_scripts section specification
[https://sourceware.org/gdb/onlinedocs/gdb/dotdebug_005fgdb_005fscripts-section.html],
each entry begins with a non-null prefix byte that specifies the kind of entry.
This commit resolves a question about magic byte and replaces a
hardcoded value with a meaningful constant "GdbScriptPythonFileId"
inside writegdbscript function.
Change-Id: I456c742bcb539a5853b9e2a6811033f35c37e7d4
GitHub-Last-Rev: 2f1c4cb9ee
GitHub-Pull-Request: golang/go#47646
Reviewed-on: https://go-review.googlesource.com/c/go/+/341391
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
The most common cases:
len(s) > 0
len(s) < 1
and they can be simplified to:
len(s) != 0
len(s) == 0
Fixes#48054
Change-Id: I16e5b0cffcfab62a4acc2a09977a6cd3543dd000
Reviewed-on: https://go-review.googlesource.com/c/go/+/346050
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Now we have two functions that create names for instantiated types.
They are inconsistent when dealing with byte/rune type.
This CL makes instTypeName2 reuse the code of typecheck.InstTypeName
Fixes#48198
Change-Id: I4c216b532cba6618ef9b63fd0b76e8f1c0ed7a75
Reviewed-on: https://go-review.googlesource.com/c/go/+/347491
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
The minimum required Linux kernel version for Go 1.18 will be changed to
2.6.32, see #45964. The dup3 syscall was added in 2.6.27, so the
fallback to use the dup2 syscall in forkAndExecInChild1 on some
platforms can be removed.
For #45964
Change-Id: I8e04d7b5b2488990a061a080ed64ea303ad048b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/347350
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
In rebasing the patch series up to CL 339015, the branches were messed
up by me, and changes from v3 to v4 of CL 339009 was lost. Fix the
ordering to restore alphabetical order per original review.
Change-Id: I8e57c96e996c4f962cab684a9d305a8dbdeea43b
Reviewed-on: https://go-review.googlesource.com/c/go/+/347731
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Meng Zhuo <mzh@golangcn.org>
This patch adds some rules to rewrite "(LeftShift (SignExtend x) lc)"
expression as "SBFIZ".
Add the test cases.
Change-Id: I294c4ba09712eeb02c7a952447bb006780f1e60d
Reviewed-on: https://go-review.googlesource.com/c/go/+/267602
Trust: fannie zhang <Fannie.Zhang@arm.com>
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
The UBFX and SBFX already zero/sign extend the result. Further
zero/sign extensions are thus unnecessary as long as they leave
the top bits unaltered. This patch absorbs zero/sign extensions
into UBFX/SBFX.
Add the related test cases.
Change-Id: I7c4516c8b52d677f77bf3aaedab87c4a28056ec0
Reviewed-on: https://go-review.googlesource.com/c/go/+/265039
Trust: fannie zhang <Fannie.Zhang@arm.com>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This reduces the number of allocations per
reflect map iteration from two to one.
For #46293
Change-Id: Ibcff5f42fc512e637b6e460bad4518e7ac83d4c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/321889
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
See the detailed explanations in the code.
Fixes#48136.
Change-Id: I1667aabfbbff97967913b080c77e7ec04ea82feb
Reviewed-on: https://go-review.googlesource.com/c/go/+/347300
Trust: Robert Griesemer <gri@golang.org>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Loading of constants that are 12 bits or smaller is currently performed using a single
ADDIW instruction, while constants between 13 bits and 32 bits are loaded using a
LUI+ADDIW pair.
Instead, use a single ADDI instruction for the 12 bits or smaller case - this
translates to the LI pseudo-instruction, making objdump more readable and giving:
11c7c: fff00293 li t0,-1
11c80: 00000313 li t1,0
Rather than:
11c7c: fff0029b addiw t0,zero,-1
11c80: 0000031b sext.w t1,zero
In the case where a constant exceeds 12 bits, an LUI instruction is required,
however if the lower 12 bits are zero, the ADDIW instruction can be omitted.
The same applies to the case where immediate splitting is performed for other
immediate instructions.
This removes around 900 instructions from the Go binary.
Change-Id: Id6c77774b3b429fa525da018a6926b85df838a2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/344457
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Rather than rewriting the obj.Prog for a MOV pseudo-instruction targeting
an address to register load, generate the appropriate machine instruction
sequence directly.
Change-Id: I507195b6d24ff3253eadcc807ddbe27dca97d220
Reviewed-on: https://go-review.googlesource.com/c/go/+/344456
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Rather than rewriting the obj.Prog for a immediate instructions that need
splitting, generate the appropriate machine instruction sequence directly.
Change-Id: Ie90f0e2a98f97a29281e445c4c3b0c47b793ef4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/344453
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Rather than rewriting the obj.Prog for a MOV pseudo-instruction targeting
a register to memory stores, generate the appropriate machine instruction
sequence directly.
Change-Id: I6eac8637e1fcb48c04d9f331cac7ae5d8cc54092
Reviewed-on: https://go-review.googlesource.com/c/go/+/344455
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Rather than rewriting the obj.Prog for a MOV pseudo-instruction targeting
a memory to register load, generate the appropriate machine instruction
sequence directly.
Change-Id: I4c7292ba00f576ec71d4842b6ff27a8ce6db0650
Reviewed-on: https://go-review.googlesource.com/c/go/+/344454
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Rather than rewriting the obj.Prog for a store instruction, generate the
appropriate machine instruction sequence directly.
Change-Id: I026250ca3d249a1013243948a4e567b708b72d0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/344452
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Rather than rewriting the obj.Prog for a load instruction, generate the
appropriate machine instruction sequence directly.
Change-Id: Iba656dbf2dff2bce02aa221d9a5cad7b7c4630d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/344451
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Rather than rewriting the obj.Prog for a MOV pseudo-instruction targeting
a constant to register load, generate the appropriate machine instruction
sequence directly.
Change-Id: I38e62f282b39be2a0a241f32280d306558d49b44
Reviewed-on: https://go-review.googlesource.com/c/go/+/344450
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This reverts commit 52aef05498.
Reason for revert: After discussion on CL 347530, it is not clear this is an improvement to the documentation.
Updates #48141
Change-Id: I5f3d9995c5f5666b92602c4b8ec393673baa73fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/347592
Trust: Cherry Mui <cherryyz@google.com>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Current wasm_exec.js does not enable ECMAScript strict mode. But it is
recommended to be enabled because it
1. eliminates some ECMAScript silent errors by changing them to throw
errors
2. fixes mistakes that make it difficult for JavaScript engines to
perform optimizations
3. prohibits some syntax likely to be defined in future versions of
ECMAScript
This commit enables ECMAScript strict mode in wasm_exec.js following the
transition guide:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_modeFixes#47116
Change-Id: Ib8ffceee37e9127698fb51304241f1e429efe83e
Reviewed-on: https://go-review.googlesource.com/c/go/+/334269
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Richard Musiol <neelance@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This factors out the machine instruction generation for MOV pseudo-instructions,
which will simplify further changes.
Change-Id: Ic0d2c3ae9e0881f7894af50ed45e93b0e4961632
Reviewed-on: https://go-review.googlesource.com/c/go/+/344461
Trust: Joel Sing <joel@sing.id.au>
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
reflect.Ptr didn't match reflect.UnsafePointer or unsafe.Pointer
so rename it to reflect.Pointer. Keep reflect.Ptr for compatibility.
Likewise with PtrTo.
Change to use it in std will come in a subsequent CL.
Fixes#47651
Change-Id: I5d4abe2b2fe10948bd68bb12c557165bedffbcba
Reviewed-on: https://go-review.googlesource.com/c/go/+/341333
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Robert Griesemer <gri@golang.org>
AttrBitOffset is deprecated (but reserved) in DWARFv4. This fix adds
logic to check the new AttrDataBitOffset attribute if AttrBitOffset
attribute is not present.
Fixes#46784
Change-Id: I7406dcaa4c98e95df72361fd4462c39e6be8879d
GitHub-Last-Rev: 5aa10d0491
GitHub-Pull-Request: golang/go#46790
Reviewed-on: https://go-review.googlesource.com/c/go/+/328709
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
We only do z>>1 once (as it should be). Remove the extra one
in the comment.
Change-Id: I6fea05fe697de07e160bd686697377babcb3e4c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/347400
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
-G=0 is in maintenance mode, so limit testing it to the longtest
builders.
Change-Id: Ie8a01866b506183d0201f2a3730377cfa663da80
Reviewed-on: https://go-review.googlesource.com/c/go/+/347298
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This is a port of CL 346471 to go/types. Additionally, CheckExpr was
updated for the new API to explicitly allow generic expressions.
The error messages in issue39634.go2 are different because go/parser
produces an IndexExpr with BadExpr index value, for backward
compatibility.
Change-Id: I725926de183a016381513fe0e750d1280688ce29
Reviewed-on: https://go-review.googlesource.com/c/go/+/347391
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>