[dev.typeparams] cmd/compile/internal/types2: adjust errors in branch checking code, fix a bug

The types2.Config.IgnoreBranches flag mistakenly excluded a
set of label-unrelated branch checks. After fixing this and
also adjusting some error messages to match the existing
compiler errors, more errorcheck tests pass now with the -G
option.

Renamed IngnoreBranches to IgnoreLabels since its controlling
label checks, not all branch statement (such as continue, etc)
checks.

Change-Id: I0819f56eb132ce76c9a9628d8942af756691065a
Reviewed-on: https://go-review.googlesource.com/c/go/+/285652
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2021-01-21 20:20:22 -08:00
parent 18bd7aa625
commit f8654579cd
4 changed files with 17 additions and 18 deletions

View file

@ -1937,13 +1937,11 @@ var excluded = map[string]bool{
"initializerr.go": true, // types2 reports extra errors
"linkname2.go": true, // error reported by noder (not running for types2 errorcheck test)
"shift1.go": true, // issue #42989
"switch4.go": true, // error reported by noder (not running for types2 errorcheck test)
"typecheck.go": true, // invalid function is not causing errors when called
"fixedbugs/bug176.go": true, // types2 reports all errors (pref: types2)
"fixedbugs/bug193.go": true, // types2 bug: shift error not reported (fixed in go/types)
"fixedbugs/bug195.go": true, // types2 reports slightly different (but correct) bugs
"fixedbugs/bug213.go": true, // error reported by noder (not running for types2 errorcheck test)
"fixedbugs/bug228.go": true, // types2 not run after syntax errors
"fixedbugs/bug231.go": true, // types2 bug? (same error reported twice)
"fixedbugs/bug255.go": true, // types2 reports extra errors
@ -1986,7 +1984,6 @@ var excluded = map[string]bool{
"fixedbugs/issue4232.go": true, // types2 reports (correct) extra errors
"fixedbugs/issue4452.go": true, // types2 reports (correct) extra errors
"fixedbugs/issue5609.go": true, // types2 needs a better error message
"fixedbugs/issue6500.go": true, // error reported by noder (not running for types2 errorcheck test)
"fixedbugs/issue6889.go": true, // types2 can handle this without constant overflow
"fixedbugs/issue7525.go": true, // types2 reports init cycle error on different line - ok otherwise
"fixedbugs/issue7525b.go": true, // types2 reports init cycle error on different line - ok otherwise