1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:24:47 -07:00
go/test
acanino b60c8203ea cmd/compile: "invalid variable name x in type switch", where x is a name of a constant
Small fix: looks like a short variable declaration with a type switch
checks to make sure the variable used had valid shape (ONAME, OTYPE, or
ONONAME) and rejects everything else. Then a new variable is declared.
If the symbol contained in the declaration was a named OLITERAL (still a
valid identifier obviously) it would be rejected, even though a new
variable would have been declared.

Fix adds this case to the check.

Added a test case from issue12413.

Fixes #12413

Change-Id: I150dadafa8ee5612c867d58031027f2dca8c6ebc
Reviewed-on: https://go-review.googlesource.com/15760
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-21 04:21:16 +00:00
..
bench test/bench/shootout: fix build 2015-07-31 17:37:58 +00:00
bugs
chan Fix several out of date references to 4g/5g/6g/8g/9g. 2015-06-26 03:38:21 +00:00
ddd2.dir
dwarf
fixedbugs cmd/compile: "invalid variable name x in type switch", where x is a name of a constant 2015-10-21 04:21:16 +00:00
import2.dir
import4.dir test: adjust gccgo expected import errors 2015-10-07 14:37:44 +00:00
interface cmd/internal/gc: improve "type *X has no field or method M" message 2015-05-07 16:21:57 +00:00
ken
method4.dir
safe
stress
syntax
64bit.go
235.go
alias1.go
alias.go
append.go
args.go
assign1.go
assign.go
bigalg.go
bigmap.go
blank1.go
blank.go
bom.go
bombad.go
bounds.go
chancap.go
chanlinear.go
char_lit1.go
char_lit.go
clearfat.go
closedchan.go
closure1.go
closure2.go
closure.go
cmp6.go
cmp.go Fix several out of date references to 4g/5g/6g/8g/9g. 2015-06-26 03:38:21 +00:00
cmplx.go
cmplxdivide1.go
cmplxdivide.c
cmplxdivide.go
complit1.go cmd/internal/gc: accept map literals with omitted key type 2015-06-04 02:31:38 +00:00
complit.go
compos.go
const1.go
const2.go
const3.go
const4.go all: link to https instead of http 2015-07-11 14:36:33 +00:00
const5.go all: link to https instead of http 2015-07-11 14:36:33 +00:00
const6.go
const.go cmd/compile: allow huge rsh in constants arithmetic 2015-08-21 20:27:22 +00:00
convert1.go
convert3.go
convert.go
convlit1.go
convlit.go cmd/internal/gc: unsafe.Pointer constants may only be converted to uintptr 2015-05-07 23:54:28 +00:00
convT2X.go
copy.go
crlf.go
ddd1.go
ddd2.go
ddd.go
decl.go
declbad.go
defer.go
deferfin.go
deferprint.go
deferprint.out
divide.go
divmod.go
empty.go
env.go
eof1.go
eof.go
errchk Fix several out of date references to 4g/5g/6g/8g/9g. 2015-06-26 03:38:21 +00:00
escape2.go cmd/compile: escape analysis, don't always escape variadic args 2015-10-04 20:45:35 +00:00
escape2n.go cmd/compile: escape analysis, don't always escape variadic args 2015-10-04 20:45:35 +00:00
escape3.go
escape4.go
escape5.go cmd/internal/gc: move check for large-hence-heap-allocated types into escape analysis 2015-05-22 02:13:54 +00:00
escape_array.go cmd/internal/gc: move check for large-hence-heap-allocated types into escape analysis 2015-05-22 02:13:54 +00:00
escape_calls.go cmd/internal/gc: make indirect calls properly escape-y 2015-05-22 01:36:11 +00:00
escape_closure.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape_field.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape_iface.go cmd/compile: add case for ODOTTYPE to escwalk 2015-07-30 17:39:44 +00:00
escape_indir.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape_level.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape_map.go
escape_param.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape_slice.go cmd/internal/gc: extend escape analysis to pointers in slices 2015-05-18 15:34:39 +00:00
escape_struct_param1.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape_struct_param2.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape_struct_return.go cmd/internal/gc: improve flow of input params to output params 2015-05-01 13:47:20 +00:00
escape.go
fibo.go
float_lit2.go
float_lit3.go
float_lit.go
floatcmp.go
for.go
func1.go
func2.go
func3.go
func4.go
func5.go
func6.go Fix several out of date references to 4g/5g/6g/8g/9g. 2015-06-26 03:38:21 +00:00
func7.go Fix several out of date references to 4g/5g/6g/8g/9g. 2015-06-26 03:38:21 +00:00
func8.go
func.go
funcdup2.go
funcdup.go
gc1.go
gc2.go
gc.go
gcstring.go
goprint.go
goprint.out
goto.go Revert "cmd/internal/gc: ignore declarations of types for goto validation" 2015-05-15 16:35:49 +00:00
heapsampling.go pprof: improve sampling for heap profiling 2015-10-05 08:15:09 +00:00
helloworld.go
helloworld.out
if.go
import1.go
import2.go
import4.go
import5.go
import.go
index0.go
index1.go
index2.go
index.go Fix several out of date references to 4g/5g/6g/8g/9g. 2015-06-26 03:38:21 +00:00
indirect1.go
indirect.go
init1.go
init.go
initcomma.go
initialize.go
initializerr.go
initloop.go cmd/compile: use []*Node instead of NodeList in sinit 2015-09-05 02:25:01 +00:00
inline.go
int_lit.go
intcvt.go
iota.go
label1.go
label.go
linkx_run.go cmd/link: detect -X setting non-string variable 2015-06-29 20:28:36 +00:00
linkx.go cmd/link: detect -X setting non-string variable 2015-06-29 20:28:36 +00:00
literal.go
live1.go
live2.go
live.go test: add -update_errors flag to run script 2015-04-10 11:33:42 +00:00
mallocfin.go
map1.go
map.go
maplinear.go
method1.go
method2.go
method3.go
method4.go
method5.go
method.go
named1.go
named.go
nil.go
nilcheck.go
nilptr2.go
nilptr3.go cmd/7g: enable peephole optimizer 2015-04-08 08:16:54 +00:00
nilptr4.go
nilptr.go
nosplit.go cmd/internal/obj/arm64: reject misaligned stack frames, except empty frames 2015-07-29 21:37:12 +00:00
nul1.go
parentype.go
peano.go
print.go
print.out
printbig.go
printbig.out
range.go
recover1.go
recover2.go
recover3.go
recover4.go test: move allocation before munmap in recover4 2015-09-16 08:51:48 +00:00
recover.go
rename1.go
rename.go
reorder2.go
reorder.go
return.go
rotate0.go test: re-enable rotate tests 2015-05-28 19:40:58 +00:00
rotate1.go test: re-enable rotate tests 2015-05-28 19:40:58 +00:00
rotate2.go test: re-enable rotate tests 2015-05-28 19:40:58 +00:00
rotate3.go test: re-enable rotate tests 2015-05-28 19:40:58 +00:00
rotate.go
run.go runtime: fix x86 stack trace for call to heap memory 2015-07-13 19:42:35 +00:00
rune.go
runtime.go
shift1.go
shift2.go
sieve.go
sigchld.go
sigchld.out
simassign.go
sinit_run.go all: retire architecture letter in file names, public API 2015-05-21 17:32:17 +00:00
sinit.go cmd/compile: allow static init for unsafe.Pointer(&x) where x is global 2015-07-07 21:51:57 +00:00
sizeof.go
slice3.go
slice3err.go
slicecap.go
sliceopt.go cmd/internal/gc: optimize slice + write barrier 2015-05-13 19:20:39 +00:00
solitaire.go
stack.go
string_lit.go
stringrange.go
struct0.go
switch3.go
switch4.go
switch.go
tinyfin.go
torture.go
turing.go
typecheck.go
typecheckloop.go cmd/compile: convert typecheck_stack to []*Node 2015-09-06 23:50:51 +00:00
typeswitch1.go
typeswitch2.go
typeswitch3.go
typeswitch.go
undef.go
utf.go
varerr.go
varinit.go
writebarrier.go cmd/internal/gc: add missing write barrier in append(x, BigStructWithPointers) 2015-05-19 15:28:29 +00:00
zerodivide.go