aboutsummaryrefslogtreecommitdiff
path: root/test/rename1.go
AgeCommit message (Collapse)Author
2023-04-19cmd/compile/internal/types2: only mark variables as used if they areRobert Griesemer
Marking variables in erroneous variable declarations as used is convenient for tests but doesn't necessarily hide follow-on errors in real code: either the variable is not supposed to be declared in the first place and then we should get an error if it is not used, or it is there because it is intended to be used, and the we expect an error it if is not used. This brings types2 closer to go/types. Change-Id: If7ee1298fc770f7ad0cefe7e968533fd50ec2343 Reviewed-on: https://go-review.googlesource.com/c/go/+/486175 Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2020-12-04[dev.typeparams] test: enable some more errorcheck testsRobert Griesemer
Change-Id: I103e3eeacd5b11efd63c965482a626878ba5ac81 Reviewed-on: https://go-review.googlesource.com/c/go/+/275216 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2019-09-06cmd/compile: rewrite untyped constant conversion logicMatthew Dempsky
This CL detangles the hairy mess that was convlit+defaultlit. In particular, it makes the following changes: 1. convlit1 now follows the standard typecheck behavior of setting "n.Type = nil" if there's an error. Notably, this means for a lot of test cases, we now avoid reporting useless follow-on error messages. For example, after reporting that "1 << s + 1.0" has an invalid shift, we no longer also report that it can't be assigned to string. 2. Previously, assignconvfn had some extra logic for trying to suppress errors from convlit/defaultlit so that it could provide its own errors with better context information. Instead, this extra context information is now passed down into convlit1 directly. 3. Relatedly, this CL also removes redundant calls to defaultlit prior to assignconv. As a consequence, when an expression doesn't make sense for a particular assignment (e.g., assigning an untyped string to an integer), the error messages now say "untyped string" instead of just "string". This is more consistent with go/types behavior. 4. defaultlit2 is now smarter about only trying to convert pairs of untyped constants when it's likely to succeed. This allows us to report better error messages for things like 3+"x"; instead of "cannot convert 3 to string" we now report "mismatched types untyped number and untyped string". Passes toolstash-check. Change-Id: I26822a02dc35855bd0ac774907b1cf5737e91882 Reviewed-on: https://go-review.googlesource.com/c/go/+/187657 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2017-08-22cmd/compile: avoid duplicate cast errorKashav Madan
If an error was already printed during LHS conversion step, we don't reprint the "cannot convert" error. In particular, this prevents `_ = int("1")` (and all similar casts) from resulting in multiple identical error messages being printed. Fixes #20812. Change-Id: If6e52c59eab438599d641ecf6f110ebafca740a9 Reviewed-on: https://go-review.googlesource.com/46912 Reviewed-by: Robert Griesemer <gri@golang.org>
2016-05-02all: make copyright headers consistent with one space after periodEmmanuel Odeke
Follows suit with https://go-review.googlesource.com/#/c/20111. Generated by running $ grep -R 'Go Authors. All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go Authors. All/Go Authors. All/g' $F;done The code in cmd/internal/unvendor wasn't changed. Fixes #15213 Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f Reviewed-on: https://go-review.googlesource.com/21819 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2012-02-24test: fix the fix of the rename tests.Rob Pike
Now they actually test again instead of just setting iota to zero. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5700058
2012-02-24test/[n-r]*.go: add documentationRob Pike
The rename ones needed redoing. R=golang-dev, bradfitz, rsc CC=golang-dev https://golang.org/cl/5698054
2012-02-16test: use testlib (final 61)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/5671080
2011-08-16errchk: allow multiple patternsRuss Cox
// ERROR "pattern1" "pattern2" means that there has to be one or more lines matching pattern1 and then excluding those, there have to be one or more lines matching pattern2. So if you expect two different error messages from a particular line, writing two separate patterns checks that both errors are produced. Also, errchk now flags lines that produce more errors than expected. Before, as long as at least one error matched the pattern, all the others were ignored. Revise tests to expect or silence these additional errors. R=lvd, r, iant CC=golang-dev https://golang.org/cl/4869044
2010-03-24delete all uses of panicln by rewriting them using panic or,Rob Pike
in the tests, println+panic. gofmt some tests too. R=rsc CC=golang-dev https://golang.org/cl/741041
2009-10-26Recognize gccgo error messages.Ian Lance Taylor
rename1.go:10:8: error: expected type rename1.go:11:10: error: expected function rename1.go:13:8: error: incompatible types in binary expression R=rsc http://go/go-review/1015013
2009-09-09defining package block names must overrideRuss Cox
universe block names. BUG=2097244 R=ken OCL=34295 CL=34473