mirror of
https://github.com/golang/go
synced 2024-11-11 22:20:22 -07: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
@ -32,6 +32,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@ -150,6 +151,13 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
|
||||
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
|
||||
errmap := make(map[string]map[uint][]syntax.Error)
|
||||
for _, filename := range filenames {
|
||||
@ -165,7 +173,6 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
|
||||
}
|
||||
|
||||
// match against found errors
|
||||
// TODO(gri) sort err list to avoid mismatched when having multiple errors
|
||||
for _, err := range errlist {
|
||||
got := unpackError(err)
|
||||
|
||||
@ -205,9 +212,8 @@ func checkFiles(t *testing.T, filenames []string, goVersion string, colDelta uin
|
||||
|
||||
// eliminate from list
|
||||
if n := len(list) - 1; n > 0 {
|
||||
// not the last entry - swap in last element and shorten list by 1
|
||||
// TODO(gri) avoid changing the order of entries
|
||||
list[index] = list[n]
|
||||
// not the last entry - slide entries down (don't reorder)
|
||||
copy(list[index:], list[index+1:])
|
||||
filemap[line] = list[:n]
|
||||
} else {
|
||||
// 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]) }
|
||||
|
||||
// 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)]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 /* ERROR must be called */ /* ERROR must be called */ )]c /* ERROR undeclared */ /* ERROR undeclared */
|
||||
|
||||
// crash 15
|
||||
func y15() { var a /* ERROR declared but not used */ interface{ p() } = G15[string]{} }
|
||||
|
Loading…
Reference in New Issue
Block a user