summaryrefslogtreecommitdiff
path: root/test/switch.go
Commit message (Collapse)AuthorAgeFilesLines
* [dev.unified] test: add switch test case for tricky nil handlingMatthew Dempsky2022-07-191-0/+14
| | | | | | | | | | | | | | | The next CL will change Unified IR's switch statement handling to convert values to empty interface in some tricky cases. My initial attempt at this accidentally mishandled `case nil:` in some cases, and this wasn't caught by any existing tests. So this CL adds one. Change-Id: Idcfaf0e869dca91be46d665e65d4623dc52bb60f Reviewed-on: https://go-review.googlesource.com/c/go/+/418099 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com>
* cmd/gc: disallow fallthrough in final case of switchTyler Bunnell2013-03-151-9/+0
| | | | | | | | Small change to cmd/gc to catch a "fallthrough" in the final case of a switch. R=golang-dev, rsc, mtj CC=golang-dev https://golang.org/cl/7841043
* cmd/gc: accept cases with same value but different types in switch.Rémy Oudompheng2013-02-261-0/+29
| | | | | | | | Fixes #4781. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7365056
* test: a number of fixes.Alan Donovan2013-02-111-7/+52
| | | | | | | | | | | | | Details: - reorder.go: delete p8. (Once expectation is changed per b/4627 it is identical to p1.) - switch.go: added some more (degenerate) switches. - range.go: improved error messages in a few cases. - method.go: added tests of calls to promoted methods. R=iant CC=golang-dev https://golang.org/cl/7306087
* cmd/gc: add missing conversion from bool to interface in switches.Daniel Morsing2012-09-171-0/+11
| | | | | | | | | | In switches without an expression, the compiler would not convert the implicit true to an interface, causing codegen errors. Fixes #3980. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6497147
* cmd/gc: accept switches on comparable arrays.Rémy Oudompheng2012-08-031-0/+32
| | | | | | | | | | | | | The compiler is incorrectly rejecting switches on arrays of comparable types. It also doesn't catch incomparable structs when typechecking the switch, leading to unreadable errors during typechecking of the generated code. Fixes #3894. R=rsc CC=gobot, golang-dev, r, remy https://golang.org/cl/6442074
* test/[n-z]*.go: add documentationRob Pike2012-02-241-0/+13
| | | | | | R=golang-dev, bradfitz, r CC=golang-dev https://golang.org/cl/5700056
* test: use testlib (final 61)Russ Cox2012-02-161-1/+1
| | | | | | | | | | | X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5671080
* gc: remove func, map compareRuss Cox2011-11-131-69/+212
| | | | | | R=ken, ken CC=golang-dev https://golang.org/cl/5373079
* test: remove semiocolons.Rob Pike2010-09-041-79/+79
| | | | | | | | The ken directory is untouched so we have some examples with explicit semis. R=gri CC=golang-dev https://golang.org/cl/2157041
* fix "declared and not used" in tests;Russ Cox2009-09-141-23/+23
| | | | | | | | | also template/template.go, missed last time. R=r DELTA=116 (61 added, 10 deleted, 45 changed) OCL=34620 CL=34622
* fix bug depot:Rob Pike2008-08-111-2/+2
| | | | | | | | | 1) fix print statements, panic statements (parentheses required) 2) len is now allowed as a var name (bug053) R=gri OCL=14106 CL=14106
* test update. also remove two duplicatesRob Pike2008-07-081-7/+7
| | | | SVN=126336
* now checks for lvalue/rvalue context ofKen Thompson2008-06-151-0/+8
| | | | | | | | | | expressions. start of generics for calling builtin functions start of map type 'any' demoted from reserved word to type SVN=122808
* - fixed a few tests and added 3 incorrectly succeeding testsRobert Griesemer2008-06-061-1/+1
| | | | | | | | - updated go_lang.txt to be more uniform and match the implementation - made makehtml work on Mac - fixed a couple of bugs in go.atg SVN=121520
* lots of new testsRob Pike2008-06-061-0/+131
SVN=121464