diff options
| author | Robert Griesemer <gri@golang.org> | 2023-03-22 15:04:35 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-03-28 18:13:13 +0000 |
| commit | 8c5e8a38df141dcb2ff8aebe87786a84ca362996 (patch) | |
| tree | 79ce55e1520aebd956fc4e449eede332c9447ae8 /test/fixedbugs | |
| parent | 422f4483f183622ecd19dc9ae98a16802c4be40e (diff) | |
| download | go-8c5e8a38df141dcb2ff8aebe87786a84ca362996.tar.xz | |
go/types, types2: refactor initVars
As with changes in prior CLs, we don't suppress legitimate
"declared but not used" errors anymore simply because the
respective variables are used in incorrect assignments,
unrelated to the variables in question.
Adjust several (ancient) tests accordingly.
Change-Id: I5826393264d9d8085c64777a330d4efeb735dd2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/478716
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Diffstat (limited to 'test/fixedbugs')
| -rw-r--r-- | test/fixedbugs/bug037.go | 1 | ||||
| -rw-r--r-- | test/fixedbugs/bug072.go | 1 | ||||
| -rw-r--r-- | test/fixedbugs/bug091.go | 1 | ||||
| -rw-r--r-- | test/fixedbugs/bug103.go | 1 | ||||
| -rw-r--r-- | test/fixedbugs/bug107.go | 1 | ||||
| -rw-r--r-- | test/fixedbugs/bug122.go | 1 | ||||
| -rw-r--r-- | test/fixedbugs/bug175.go | 1 | ||||
| -rw-r--r-- | test/fixedbugs/issue19012.go | 2 | ||||
| -rw-r--r-- | test/fixedbugs/issue48558.go | 8 |
9 files changed, 16 insertions, 1 deletions
diff --git a/test/fixedbugs/bug037.go b/test/fixedbugs/bug037.go index f17fb3fd74..ed95cacc96 100644 --- a/test/fixedbugs/bug037.go +++ b/test/fixedbugs/bug037.go @@ -8,4 +8,5 @@ package main func main() { s := vlong(0); // ERROR "undef" + _ = s } diff --git a/test/fixedbugs/bug072.go b/test/fixedbugs/bug072.go index 05ad93dac2..1c0c4ee12a 100644 --- a/test/fixedbugs/bug072.go +++ b/test/fixedbugs/bug072.go @@ -8,4 +8,5 @@ package main func main() { s := string(bug); // ERROR "undef" + _ = s } diff --git a/test/fixedbugs/bug091.go b/test/fixedbugs/bug091.go index dbb1287a15..0e239e023a 100644 --- a/test/fixedbugs/bug091.go +++ b/test/fixedbugs/bug091.go @@ -18,6 +18,7 @@ func f2() { func f3() { i := c // ERROR "undef" + _ = i } func main() { diff --git a/test/fixedbugs/bug103.go b/test/fixedbugs/bug103.go index 1cb710e368..743a3c4b4f 100644 --- a/test/fixedbugs/bug103.go +++ b/test/fixedbugs/bug103.go @@ -10,5 +10,6 @@ func f() /* no return type */ {} func main() { x := f(); // ERROR "mismatch|as value|no type" + _ = x } diff --git a/test/fixedbugs/bug107.go b/test/fixedbugs/bug107.go index dcd8e9d113..e4b9eb1e94 100644 --- a/test/fixedbugs/bug107.go +++ b/test/fixedbugs/bug107.go @@ -11,5 +11,6 @@ func f() (os int) { // In the next line "os" should refer to the result variable, not // to the package. v := os.Open("", 0, 0); // ERROR "undefined" + _ = v return 0 } diff --git a/test/fixedbugs/bug122.go b/test/fixedbugs/bug122.go index 5640cf263a..0d9dcd1807 100644 --- a/test/fixedbugs/bug122.go +++ b/test/fixedbugs/bug122.go @@ -9,4 +9,5 @@ package main func main() { // should allow at most 2 sizes a := make([]int, 10, 20, 30, 40); // ERROR "too many|expects 2 or 3 arguments; found 5" + _ = a } diff --git a/test/fixedbugs/bug175.go b/test/fixedbugs/bug175.go index caf3168536..f19025a7a6 100644 --- a/test/fixedbugs/bug175.go +++ b/test/fixedbugs/bug175.go @@ -10,4 +10,5 @@ func f() (int, bool) { return 0, true } func main() { x, y := f(), 2 // ERROR "multi|2-valued" + _, _ = x, y } diff --git a/test/fixedbugs/issue19012.go b/test/fixedbugs/issue19012.go index 77b2236063..c911a9a1d0 100644 --- a/test/fixedbugs/issue19012.go +++ b/test/fixedbugs/issue19012.go @@ -15,7 +15,7 @@ func f(x int, y uint) { if true { return "a" > 10 // ERROR "^too many arguments to return$|return with value in function with no return|no result values expected|mismatched types" } - return "gopher" == true, 10 // ERROR "^too many arguments to return$|return with value in function with no return|no result values expected|mismatched types" + return "gopher" == true, 10 // ERROR "^too many arguments to return$|return with value in function with no return|no result values expected|mismatched types" "too many return values" } func main() { diff --git a/test/fixedbugs/issue48558.go b/test/fixedbugs/issue48558.go index 9ab56d9e46..590fd9b7c1 100644 --- a/test/fixedbugs/issue48558.go +++ b/test/fixedbugs/issue48558.go @@ -41,6 +41,10 @@ func _() { a1 := f3() // ERROR "assignment mismatch: 1 variable but f3 returns 3 values" a2, b2 := f1() // ERROR "assignment mismatch: 2 variables but f1 returns 1 value" a3, b3, c3 := f2() // ERROR "assignment mismatch: 3 variables but f2 returns 2 values" + + _ = a1 + _, _ = a2, b2 + _, _, _ = a3, b3, c3 } type T struct{} @@ -66,6 +70,10 @@ func _(x T) { a1 := x.f3() // ERROR "assignment mismatch: 1 variable but .\.f3 returns 3 values" a2, b2 := x.f1() // ERROR "assignment mismatch: 2 variables but .\.f1 returns 1 value" a3, b3, c3 := x.f2() // ERROR "assignment mismatch: 3 variables but .\.f2 returns 2 values" + + _ = a1 + _, _ = a2, b2 + _, _, _ = a3, b3, c3 } // some one-off cases |
