aboutsummaryrefslogtreecommitdiff
path: root/test/const.go
AgeCommit message (Collapse)Author
2019-09-26cmd/compile: apply constant folding to ORUNESTRMatthew Dempsky
ORUNESTR represents the special case of integer->string conversion. If the integer is a constant, then the string is a constant too, so evconst needs to perform constant folding here. Passes toolstash-check. Fixes #34563. Change-Id: Ieab3d76794d8ce570106b6b707a4bcd725d156e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/197677 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-28cmd/compile: truncate constant arithmetic result with typed complex numbersCholerae Hu
Fixes #33285 Change-Id: Idd125e3342058051216be3f105330aef987320c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/187697 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-09-17cmd/compile: fix compiler bug for constant equality comparisonTrey Lawrence
The compiler incorrectly will error when comparing a nil pointer interface to a nil pointer of any other type. Example: (*int)(nil) == interface{}(nil) Will error with "gc: illegal constant expression: *int == interface {}" Fixes #16702 Change-Id: I1a15d651df2cfca6762b1783a28b377b2e6ff8c6 Reviewed-on: https://go-review.googlesource.com/27591 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2015-08-21cmd/compile: allow huge rsh in constants arithmeticAlberto Donizetti
Currently an expression like var v = 0 >> 1000 is rejected by gc with a "stupid shift" error, while gotype compiles it successfully. As suggested by gri on the issue tracker, allow an rsh right operand to be any valid uint value. Fixes #11328 Change-Id: I6ccb3b7f842338d91fd26ae37dd4fa279d7fc440 Reviewed-on: https://go-review.googlesource.com/13777 Reviewed-by: Robert Griesemer <gri@golang.org>
2013-02-21exp/ssa/interp: (#6 of 5): test interpretation of SSA form of $GOROOT/test/*.go.Alan Donovan
The interpreter's os.Exit now triggers a special panic rather than kill the test process. (It's semantically dubious, since it will run deferred routines.) Interpret now returns its exit code rather than calling os.Exit. Also: - disabled parts of a few $GOROOT/tests via os.Getenv("GOSSAINTERP"). - remove unnecessary 'slots' param to external functions; they are never closures. Most of the tests are disabled until go/types supports shifts. They can be reenabled if you patch this workaround: https://golang.org/cl/7312068 R=iant, bradfitz CC=golang-dev, gri https://golang.org/cl/7313062
2012-02-19test: [a-c]: add introductory comments to testsRob Pike
Very few of the compiler regression tests include a comment saying waht they do. Many are obvious, some are anything but. I've started with a-c in the top directory. More will follow once we agree on the approach, correctness, and thoroughness here. zerodivide.go sneaked in too. R=rsc, r CC=golang-dev https://golang.org/cl/5656100
2012-02-16test: use testlib (first 100)Russ Cox
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/5656082
2010-09-04test: remove semiocolons.Rob Pike
The ken directory is untouched so we have some examples with explicit semis. R=gri CC=golang-dev https://golang.org/cl/2157041
2009-03-12make 6g constants behave as ken proposes. (i hope.)Russ Cox
various bug fixes and tests involving constants. test/const1.go is the major new test case. R=ken OCL=26216 CL=26224
2008-11-17fix the easy parts of bug120Russ Cox
R=r,ken DELTA=66 (52 added, 3 deleted, 11 changed) OCL=19386 CL=19389
2008-08-20bugs related to constat typesRobert Griesemer
R=r DELTA=10 (6 added, 4 deleted, 0 changed) OCL=14348 CL=14348
2008-08-13add test for constantsRob Pike
add bug in constant evaluation (erroneously allowing assignment of float to int) update golden R=gri OCL=14153 CL=14153