From: Cuong Manh Le Date: Fri, 25 Jun 2021 04:17:04 +0000 (+0700) Subject: [dev.typeparams] all: merge master (37f9a8f) into dev.typeparams X-Git-Tag: go1.18beta1~1818^2^2~271^2 X-Git-Url: http://www.git.cypherpunks.ru/?a=commitdiff_plain;h=ac2de11cfbea4e7979a5151e5fb03d70cdb3955f;p=gostls13.git [dev.typeparams] all: merge master (37f9a8f) into dev.typeparams Conflicts: - src/go/types/check_test.go CL 330629 fixed a bug in package qualification logic - src/internal/buildcfg/exp.go CL 329930 make parseExperiments get go arch string as input param Merge List: + 2021-06-25 37f9a8f69d go/types: fix a bug in package qualification logic + 2021-06-24 c309c89db5 reflect: document that InterfaceData is a low-entropy RNG + 2021-06-24 cce621431a cmd/compile: fix wrong type in SSA generation for OSLICE2ARRPTR + 2021-06-24 600a2a4ffb cmd/go: don't try to add replaced versions that won't be selected + 2021-06-24 a9bb38222a net: remove hard-coded timeout in dialClosedPort test helper + 2021-06-24 86d72fa2cb time: handle invalid UTF-8 byte sequences in quote to prevent panic + 2021-06-24 44a12e5f33 cmd/go: search breadth-first instead of depth-first for test dependency cycles + 2021-06-24 73496e0df0 net: use absDomainName in the Windows lookupPTR test helper + 2021-06-24 222ed1b38a os: enable TestFifoEOF on openbsd + 2021-06-22 0ebd5a8de0 cmd/go: update ToolTags based on GOARCH value + 2021-06-22 5bd09e5efc spec: unsafe.Add/Slice are not permitted in statement context + 2021-06-22 666315b4d3 runtime/internal/atomic: remove incorrect pointer indirection in comment + 2021-06-22 63daa774b5 go/types: guard against checking instantiation when generics is disabled + 2021-06-22 197a5ee2ab cmd/gofmt: remove stale documentation for the -G flag + 2021-06-22 9afd158eb2 go/parser: parse an ast.IndexExpr for a[] + 2021-06-21 1bd5a20e3c cmd/go: add a -go flag to 'go mod graph' + 2021-06-21 761edf71f6 cmd/internal/moddeps: use a temporary directory for GOMODCACHE if needed + 2021-06-21 a0400420ad cmd/internal/moddeps: use -mod=readonly instead of -mod=mod + 2021-06-21 3f9ec83b10 cmd/go: document GOPPC64 environment variable + 2021-06-21 20bdfba325 go/scanner: fall back to next() when encountering 0 bytes in parseIdentifier + 2021-06-21 44f9a3566c database/sql: fix deadlock test in prepare statement Change-Id: I16490e8ea70ee65081f467223857033842da513a --- ac2de11cfbea4e7979a5151e5fb03d70cdb3955f diff --cc src/go/types/check_test.go index 0926ac7431,c85a8e46fb..a5720f992e --- a/src/go/types/check_test.go +++ b/src/go/types/check_test.go @@@ -202,7 -202,7 +202,7 @@@ func asGoVersion(s string) string return "" } - func testFiles(t *testing.T, sizes Sizes, filenames []string, srcs [][]byte, manual bool) { -func checkFiles(t *testing.T, sizes Sizes, goVersion string, filenames []string, srcs [][]byte, manual bool, imp Importer) { ++func testFiles(t *testing.T, sizes Sizes, filenames []string, srcs [][]byte, manual bool, imp Importer) { if len(filenames) == 0 { t.Fatal("no source files") } @@@ -339,7 -325,7 +345,7 @@@ func TestManual(t *testing.T) func TestLongConstants(t *testing.T) { format := "package longconst\n\nconst _ = %s\nconst _ = %s // ERROR excessively long constant" src := fmt.Sprintf(format, strings.Repeat("1", 9999), strings.Repeat("1", 10001)) - testFiles(t, nil, []string{"longconst.go"}, [][]byte{[]byte(src)}, false) - checkFiles(t, nil, "", []string{"longconst.go"}, [][]byte{[]byte(src)}, false, nil) ++ testFiles(t, nil, []string{"longconst.go"}, [][]byte{[]byte(src)}, false, nil) } // TestIndexRepresentability tests that constant index operands must @@@ -347,7 -333,7 +353,7 @@@ // represent larger values. func TestIndexRepresentability(t *testing.T) { const src = "package index\n\nvar s []byte\nvar _ = s[int64 /* ERROR \"int64\\(1\\) << 40 \\(.*\\) overflows int\" */ (1) << 40]" - testFiles(t, &StdSizes{4, 4}, []string{"index.go"}, [][]byte{[]byte(src)}, false) - checkFiles(t, &StdSizes{4, 4}, "", []string{"index.go"}, [][]byte{[]byte(src)}, false, nil) ++ testFiles(t, &StdSizes{4, 4}, []string{"index.go"}, [][]byte{[]byte(src)}, false, nil) } func TestIssue46453(t *testing.T) { @@@ -355,17 -341,17 +361,17 @@@ t.Skip("type params are enabled") } const src = "package p\ntype _ comparable // ERROR \"undeclared name: comparable\"" - testFiles(t, nil, []string{"issue46453.go"}, [][]byte{[]byte(src)}, false) - checkFiles(t, nil, "", []string{"issue46453.go"}, [][]byte{[]byte(src)}, false, nil) ++ testFiles(t, nil, []string{"issue46453.go"}, [][]byte{[]byte(src)}, false, nil) } -func TestCheck(t *testing.T) { DefPredeclaredTestFuncs(); testDir(t, "check") } -func TestExamples(t *testing.T) { testDir(t, "examples") } -func TestFixedbugs(t *testing.T) { testDir(t, "fixedbugs") } +func TestCheck(t *testing.T) { DefPredeclaredTestFuncs(); testDirFiles(t, "testdata/check", false) } +func TestExamples(t *testing.T) { testDirFiles(t, "testdata/examples", false) } +func TestFixedbugs(t *testing.T) { testDirFiles(t, "testdata/fixedbugs", false) } -func testDir(t *testing.T, dir string) { +func testDirFiles(t *testing.T, dir string, manual bool) { testenv.MustHaveGoBuild(t) + dir = filepath.FromSlash(dir) - dir = filepath.Join("testdata", dir) fis, err := os.ReadDir(dir) if err != nil { t.Error(err) @@@ -415,5 -391,5 +421,5 @@@ func testPkg(t *testing.T, filenames [] } srcs[i] = src } - testFiles(t, nil, filenames, srcs, manual) - checkFiles(t, nil, goVersion, filenames, srcs, manual, nil) ++ testFiles(t, nil, filenames, srcs, manual, nil) } diff --cc src/go/types/issues_test.go index 44926919ef,519e199536..51995af30a --- a/src/go/types/issues_test.go +++ b/src/go/types/issues_test.go @@@ -593,26 -632,9 +632,9 @@@ var _ T = template /* ERROR cannot use. if err != nil { t.Fatalf("package a failed to typecheck: %v", err) } - conf := Config{Importer: importHelper{pkg: a, fallback: importer.Default()}} - - // Packages should be fully qualified when there is ambiguity within the - // error string itself. - bast := mustParse(t, bsrc) - _, err = conf.Check(bast.Name.Name, fset, []*ast.File{bast}, nil) - if err == nil { - t.Fatal("package b had no errors") - } - if !strings.Contains(err.Error(), "text/template") || !strings.Contains(err.Error(), "html/template") { - t.Errorf("type checking error for b does not disambiguate package template: %q", err) - } + imp := importHelper{pkg: a, fallback: importer.Default()} - // ...and also when there is any ambiguity in reachable packages. - cast := mustParse(t, csrc) - _, err = conf.Check(cast.Name.Name, fset, []*ast.File{cast}, nil) - if err == nil { - t.Fatal("package c had no errors") - } - if !strings.Contains(err.Error(), "html/template") { - t.Errorf("type checking error for c does not disambiguate package template: %q", err) - } - checkFiles(t, nil, "", []string{"b.go"}, [][]byte{[]byte(bsrc)}, false, imp) - checkFiles(t, nil, "", []string{"c.go"}, [][]byte{[]byte(csrc)}, false, imp) - checkFiles(t, nil, "", []string{"t.go"}, [][]byte{[]byte(tsrc)}, false, imp) ++ testFiles(t, nil, []string{"b.go"}, [][]byte{[]byte(bsrc)}, false, imp) ++ testFiles(t, nil, []string{"c.go"}, [][]byte{[]byte(csrc)}, false, imp) ++ testFiles(t, nil, []string{"t.go"}, [][]byte{[]byte(tsrc)}, false, imp) } diff --cc src/internal/buildcfg/exp.go index e78f987999,640aa1934d..e87b6221f1 --- a/src/internal/buildcfg/exp.go +++ b/src/internal/buildcfg/exp.go @@@ -18,10 -18,9 +18,10 @@@ import // // (This is not necessarily the set of experiments the compiler itself // was built with.) - var Experiment goexperiment.Flags = parseExperiments() + var Experiment goexperiment.Flags = parseExperiments(GOARCH) -var regabiSupported = GOARCH == "amd64" && (GOOS == "android" || GOOS == "linux" || GOOS == "darwin" || GOOS == "windows") +var regabiSupported = GOARCH == "amd64" || GOARCH == "arm64" +var regabiDeveloping = false // experimentBaseline specifies the experiment flags that are enabled by // default in the current toolchain. This is, in effect, the "control" @@@ -95,14 -98,12 +95,14 @@@ func parseExperiments(goarch string) go } } - // regabi is only supported on amd64. - if goarch != "amd64" { + // regabiwrappers is always enabled on amd64. - if GOARCH == "amd64" { ++ if goarch == "amd64" { + flags.RegabiWrappers = true + } + // regabi is only supported on amd64 and arm64. - if GOARCH != "amd64" && GOARCH != "arm64" { ++ if goarch != "amd64" && goarch != "arm64" { flags.RegabiWrappers = false - flags.RegabiG = false flags.RegabiReflect = false - flags.RegabiDefer = false flags.RegabiArgs = false } // Check regabi dependencies.