aboutsummaryrefslogtreecommitdiff
path: root/test/interface
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2023-03-22 11:59:39 -0700
committerGopher Robot <gobot@golang.org>2023-03-28 14:28:33 +0000
commitabf9b112fd12e05da2d064554d51d140c2871741 (patch)
tree712f4b3cf615b72855824259b3d58a7b3c476552 /test/interface
parent3ed8a1e629e95dc6337a73d5db9936dabd43f4f4 (diff)
downloadgo-abf9b112fd12e05da2d064554d51d140c2871741.tar.gz
go-abf9b112fd12e05da2d064554d51d140c2871741.zip
go/types, types2: more systematic use of Checker.use und useLHS
This CL re-introduces useLHS because we don't want to suppress correct "declared but not used" errors for variables that only appear on the LHS of an assignment (using Checker.use would mark them as used). This CL also adjusts a couple of places where types2 differed from go/types (and suppressed valid "declared and not used" errors). Now those errors are surfaced. Adjusted a handful of tests accordingly. Change-Id: Ia555139a05049887aeeec9e5221b1f41432c1a57 Reviewed-on: https://go-review.googlesource.com/c/go/+/478635 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> Run-TryBot: Robert Griesemer <gri@google.com>
Diffstat (limited to 'test/interface')
-rw-r--r--test/interface/pointer.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/interface/pointer.go b/test/interface/pointer.go
index a71b3f4bf8..c9651d2ce6 100644
--- a/test/interface/pointer.go
+++ b/test/interface/pointer.go
@@ -31,7 +31,7 @@ func AddInst(Inst) *Inst {
func main() {
print("call addinst\n")
- var x Inst = AddInst(new(Start)) // ERROR "pointer to interface|incompatible type"
+ var _ Inst = AddInst(new(Start)) // ERROR "pointer to interface|incompatible type"
print("return from addinst\n")
- var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type"
+ var _ *Inst = new(Start) // ERROR "pointer to interface|incompatible type"
}