]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/types/generate_test.go
go/types, types2: remove local version processing in favor of go/version
[gostls13.git] / src / go / types / generate_test.go
index 083a66cfe068b9488e3912be8083ba8924e40b62..e74a1e6f2566462a08d6114379aa894404a93869 100644 (file)
@@ -95,18 +95,24 @@ func generate(t *testing.T, filename string, write bool) {
 type action func(in *ast.File)
 
 var filemap = map[string]action{
+       "alias.go":        nil,
        "array.go":        nil,
        "basic.go":        nil,
        "chan.go":         nil,
+       "const.go":        func(f *ast.File) { fixTokenPos(f) },
        "context.go":      nil,
        "context_test.go": nil,
        "gccgosizes.go":   nil,
-       "hilbert_test.go": nil,
-       "infer.go":        func(f *ast.File) { fixTokenPos(f); fixInferSig(f) },
+       "gcsizes.go":      func(f *ast.File) { renameIdent(f, "IsSyncAtomicAlign64", "_IsSyncAtomicAlign64") },
+       "hilbert_test.go": func(f *ast.File) { renameImportPath(f, `"cmd/compile/internal/types2"`, `"go/types"`) },
+       "infer.go": func(f *ast.File) {
+               fixTokenPos(f)
+               fixInferSig(f)
+       },
        // "initorder.go": fixErrErrorfCall, // disabled for now due to unresolved error_ use implications for gopls
        "instantiate.go":      func(f *ast.File) { fixTokenPos(f); fixCheckErrorfCall(f) },
        "instantiate_test.go": func(f *ast.File) { renameImportPath(f, `"cmd/compile/internal/types2"`, `"go/types"`) },
-       "lookup.go":           nil,
+       "lookup.go":           func(f *ast.File) { fixTokenPos(f) },
        "main_test.go":        nil,
        "map.go":              nil,
        "named.go":            func(f *ast.File) { fixTokenPos(f); fixTraceSel(f) },
@@ -206,7 +212,7 @@ func fixInferSig(f *ast.File) {
        ast.Inspect(f, func(n ast.Node) bool {
                switch n := n.(type) {
                case *ast.FuncDecl:
-                       if n.Name.Name == "infer" || n.Name.Name == "infer1" || n.Name.Name == "infer2" {
+                       if n.Name.Name == "infer" {
                                // rewrite (pos token.Pos, ...) to (posn positioner, ...)
                                par := n.Type.Params.List[0]
                                if len(par.Names) == 1 && par.Names[0].Name == "pos" {
@@ -227,16 +233,22 @@ func fixInferSig(f *ast.File) {
                                                n.Args[0] = arg
                                                return false
                                        }
-                               case "errorf", "infer1", "infer2":
+                               case "errorf":
                                        // rewrite check.errorf(pos, ...) to check.errorf(posn, ...)
-                                       // rewrite check.infer1(pos, ...) to check.infer1(posn, ...)
-                                       // rewrite check.infer2(pos, ...) to check.infer2(posn, ...)
                                        if ident, _ := n.Args[0].(*ast.Ident); ident != nil && ident.Name == "pos" {
                                                pos := n.Args[0].Pos()
                                                arg := newIdent(pos, "posn")
                                                n.Args[0] = arg
                                                return false
                                        }
+                               case "allowVersion":
+                                       // rewrite check.allowVersion(..., pos, ...) to check.allowVersion(..., posn, ...)
+                                       if ident, _ := n.Args[1].(*ast.Ident); ident != nil && ident.Name == "pos" {
+                                               pos := n.Args[1].Pos()
+                                               arg := newIdent(pos, "posn")
+                                               n.Args[1] = arg
+                                               return false
+                                       }
                                }
                        }
                }