mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/types2: process errors in src order during testing
Follow-up on https://golang.org/cl/305573. As a consequence, re-enable test case that caused problems with that CL. Change-Id: Ibffee3f016f4885a55b8e527a5680dd437322209 Reviewed-on: https://go-review.googlesource.com/c/go/+/307216 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
8f1099b585
commit
836356bdaa
2 changed files with 11 additions and 6 deletions
|
|
@ -32,6 +32,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
|
@ -150,6 +151,13 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort errlist in source order
|
||||||
|
sort.Slice(errlist, func(i, j int) bool {
|
||||||
|
pi := unpackError(errlist[i]).Pos
|
||||||
|
pj := unpackError(errlist[j]).Pos
|
||||||
|
return pi.Cmp(pj) < 0
|
||||||
|
})
|
||||||
|
|
||||||
// collect expected errors
|
// collect expected errors
|
||||||
errmap := make(map[string]map[uint][]syntax.Error)
|
errmap := make(map[string]map[uint][]syntax.Error)
|
||||||
for _, filename := range filenames {
|
for _, filename := range filenames {
|
||||||
|
|
@ -165,7 +173,6 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
|
||||||
}
|
}
|
||||||
|
|
||||||
// match against found errors
|
// match against found errors
|
||||||
// TODO(gri) sort err list to avoid mismatched when having multiple errors
|
|
||||||
for _, err := range errlist {
|
for _, err := range errlist {
|
||||||
got := unpackError(err)
|
got := unpackError(err)
|
||||||
|
|
||||||
|
|
@ -205,9 +212,8 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
|
||||||
|
|
||||||
// eliminate from list
|
// eliminate from list
|
||||||
if n := len(list) - 1; n > 0 {
|
if n := len(list) - 1; n > 0 {
|
||||||
// not the last entry - swap in last element and shorten list by 1
|
// not the last entry - slide entries down (don't reorder)
|
||||||
// TODO(gri) avoid changing the order of entries
|
copy(list[index:], list[index+1:])
|
||||||
list[index] = list[n]
|
|
||||||
filemap[line] = list[:n]
|
filemap[line] = list[:n]
|
||||||
} else {
|
} else {
|
||||||
// last entry - remove list from filemap
|
// last entry - remove list from filemap
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ type foo9[A any] interface { type foo9 /* ERROR interface contains type constrai
|
||||||
func _() { var _ = new(foo9 /* ERROR interface contains type constraints */ [int]) }
|
func _() { var _ = new(foo9 /* ERROR interface contains type constraints */ [int]) }
|
||||||
|
|
||||||
// crash 12
|
// crash 12
|
||||||
// TODO(gri) temporarily disabled due to an error check issue
|
var u /* ERROR cycle */ , i [func /* ERROR used as value */ /* ERROR used as value */ (u, c /* ERROR undeclared */ /* ERROR undeclared */ ) {}(0, len /* ERROR must be called */ /* ERROR must be called */ )]c /* ERROR undeclared */ /* ERROR undeclared */
|
||||||
// var u /* ERROR cycle */ , i [func /* ERROR used as value */ /* ERROR used as value */ (u, c /* ERROR undeclared */ /* ERROR undeclared */ ) {}(0, len)]c /* ERROR undeclared */ /* ERROR undeclared */
|
|
||||||
|
|
||||||
// crash 15
|
// crash 15
|
||||||
func y15() { var a /* ERROR declared but not used */ interface{ p() } = G15[string]{} }
|
func y15() { var a /* ERROR declared but not used */ interface{ p() } = G15[string]{} }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue