From 8d48d9a84db055bfd10a0bad4076c344369ad8c5 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Fri, 14 Mar 2025 01:48:09 +0800 Subject: [PATCH 1/2] replace interface{} => any --- ast/gopq/dom.go | 14 ++++++------ ast/gopq/gopq.go | 6 ++--- ast/gopq/helper.go | 2 +- ast/print.go | 18 +++++++-------- ast/resolve.go | 2 +- ast/scope.go | 8 +++---- builtin/ng/big.go | 2 +- cl/builtin_test.go | 2 +- cl/compile.go | 8 +++---- cl/internal/spx/game.go | 10 ++++---- cl/internal/spx/sprite.go | 26 ++++++++++----------- cl/stmt.go | 4 ++-- cmd/internal/env/env.go | 6 ++--- cmd/internal/help/help.go | 2 +- cmd/internal/mod/mod.go | 2 +- demo/mixgo/a.go | 2 +- format/format.go | 2 +- parser/fsx/memfs/fs.go | 4 ++-- parser/fsx/memfs/memfs.go | 2 +- parser/interface.go | 2 +- parser/parser.go | 4 ++-- parser/parser_gop.go | 12 +++++----- parser/parser_test.go | 2 +- parser/parserdir_test.go | 4 ++-- parser/parsertest/parsertest.go | 4 ++-- printer/printer.go | 14 ++++++------ scanner/scanner.go | 2 +- x/build/build.go | 4 ++-- x/build/build_test.go | 4 ++-- x/jsonrpc2/conn.go | 14 ++++++------ x/jsonrpc2/jsonrpc2.go | 16 ++++++------- x/jsonrpc2/jsonrpc2test/cases/testcase.go | 28 +++++++++++------------ x/jsonrpc2/messages.go | 12 +++++----- x/jsonrpc2/wire.go | 2 +- x/langserver/server.go | 2 +- x/typesutil/check_test.go | 4 ++-- x/typesutil/info_test.go | 6 ++--- 37 files changed, 129 insertions(+), 129 deletions(-) diff --git a/ast/gopq/dom.go b/ast/gopq/dom.go index 440ebdf47..9f063e30f 100644 --- a/ast/gopq/dom.go +++ b/ast/gopq/dom.go @@ -38,7 +38,7 @@ func (p astPackages) ForEach(filter func(node Node) error) error { return nil } -func (p astPackages) Obj() interface{} { +func (p astPackages) Obj() any { return p } @@ -58,7 +58,7 @@ func (p astPackage) ForEach(filter func(node Node) error) error { return nil } -func (p astPackage) Obj() interface{} { +func (p astPackage) Obj() any { return p.Package } @@ -78,7 +78,7 @@ func (p astFile) ForEach(filter func(node Node) error) error { return nil } -func (p astFile) Obj() interface{} { +func (p astFile) Obj() any { return p.File } @@ -100,7 +100,7 @@ func (p *astDecl) ForEach(filter func(node Node) error) error { return nil } -func (p *astDecl) Obj() interface{} { +func (p *astDecl) Obj() any { return p.Decl } @@ -114,7 +114,7 @@ func (p *astSpec) ForEach(filter func(node Node) error) error { return nil } -func (p *astSpec) Obj() interface{} { +func (p *astSpec) Obj() any { return p.Spec } @@ -155,7 +155,7 @@ func (p *astStmt) ForEach(filter func(node Node) error) error { return nil } -func (p *astStmt) Obj() interface{} { +func (p *astStmt) Obj() any { return p.Stmt } @@ -169,7 +169,7 @@ func (p *astExpr) ForEach(filter func(node Node) error) error { return nil } -func (p *astExpr) Obj() interface{} { +func (p *astExpr) Obj() any { return p.Expr } diff --git a/ast/gopq/gopq.go b/ast/gopq/gopq.go index 8e86c96c8..49c22a652 100644 --- a/ast/gopq/gopq.go +++ b/ast/gopq/gopq.go @@ -51,7 +51,7 @@ var ( type Node interface { ast.Node ForEach(filter func(node Node) error) error - Obj() interface{} + Obj() any } // NodeEnum - node enumerator @@ -66,7 +66,7 @@ type NodeSet struct { } // FromFile calls ParseFile for a single file and returns *ast.File node set. -func FromFile(fset *token.FileSet, filename string, src interface{}, mode parser.Mode) (doc NodeSet, err error) { +func FromFile(fset *token.FileSet, filename string, src any, mode parser.Mode) (doc NodeSet, err error) { file, err := parser.ParseFile(fset, filename, src, mode) if err != nil { return @@ -77,7 +77,7 @@ func FromFile(fset *token.FileSet, filename string, src interface{}, mode parser // FromFSFile calls ParseFSFile for a single file and returns *ast.File node set. func FromFSFile( fset *token.FileSet, fs fsx.FileSystem, - filename string, src interface{}, mode parser.Mode) (doc NodeSet, err error) { + filename string, src any, mode parser.Mode) (doc NodeSet, err error) { file, err := parser.ParseFSFile(fset, fs, filename, src, mode) if err != nil { return diff --git a/ast/gopq/helper.go b/ast/gopq/helper.go index ffeda30ae..de81bf575 100644 --- a/ast/gopq/helper.go +++ b/ast/gopq/helper.go @@ -148,7 +148,7 @@ func NameOf(node Node) string { return getName(node.Obj(), false) } -func getName(v interface{}, useEmpty bool) string { +func getName(v any, useEmpty bool) string { switch v := v.(type) { case *ast.FuncDecl: return v.Name.Name diff --git a/ast/print.go b/ast/print.go index de68a208e..4544e176c 100644 --- a/ast/print.go +++ b/ast/print.go @@ -49,17 +49,17 @@ func NotNilFilter(_ string, v reflect.Value) bool { // struct fields for which f(fieldname, fieldvalue) is true are // printed; all others are filtered from the output. Unexported // struct fields are never printed. -func Fprint(w io.Writer, fset *token.FileSet, x interface{}, f FieldFilter) error { +func Fprint(w io.Writer, fset *token.FileSet, x any, f FieldFilter) error { return fprint(w, fset, x, f) } -func fprint(w io.Writer, fset *token.FileSet, x interface{}, f FieldFilter) (err error) { +func fprint(w io.Writer, fset *token.FileSet, x any, f FieldFilter) (err error) { // setup printer p := printer{ output: w, fset: fset, filter: f, - ptrmap: make(map[interface{}]int), + ptrmap: make(map[any]int), last: '\n', // force printing of line number on first line } @@ -83,7 +83,7 @@ func fprint(w io.Writer, fset *token.FileSet, x interface{}, f FieldFilter) (err // Print prints x to standard output, skipping nil fields. // Print(fset, x) is the same as Fprint(os.Stdout, fset, x, NotNilFilter). -func Print(fset *token.FileSet, x interface{}) error { +func Print(fset *token.FileSet, x any) error { return Fprint(os.Stdout, fset, x, NotNilFilter) } @@ -91,10 +91,10 @@ type printer struct { output io.Writer fset *token.FileSet filter FieldFilter - ptrmap map[interface{}]int // *T -> line number - indent int // current indentation level - last byte // the last byte processed by Write - line int // current line number + ptrmap map[any]int // *T -> line number + indent int // current indentation level + last byte // the last byte processed by Write + line int // current line number } var indent = []byte(". ") @@ -138,7 +138,7 @@ type localError struct { } // printf is a convenience wrapper that takes care of print errors. -func (p *printer) printf(format string, args ...interface{}) { +func (p *printer) printf(format string, args ...any) { if _, err := fmt.Fprintf(p, format, args...); err != nil { panic(localError{err}) } diff --git a/ast/resolve.go b/ast/resolve.go index 54e3696f6..770177e55 100644 --- a/ast/resolve.go +++ b/ast/resolve.go @@ -35,7 +35,7 @@ func (p *pkgBuilder) error(pos token.Pos, msg string) { p.errors.Add(p.fset.Position(pos), msg) } -func (p *pkgBuilder) errorf(pos token.Pos, format string, args ...interface{}) { +func (p *pkgBuilder) errorf(pos token.Pos, format string, args ...any) { p.error(pos, fmt.Sprintf(format, args...)) } diff --git a/ast/scope.go b/ast/scope.go index cd0a70255..992d3802a 100644 --- a/ast/scope.go +++ b/ast/scope.go @@ -84,10 +84,10 @@ func (s *Scope) String() string { // Con int iota for the respective declaration type Object struct { Kind ObjKind - Name string // declared name - Decl interface{} // corresponding Field, XxxSpec, FuncDecl, LabeledStmt, AssignStmt, Scope; or nil - Data interface{} // object-specific data; or nil - Type interface{} // placeholder for type information; may be nil + Name string // declared name + Decl any // corresponding Field, XxxSpec, FuncDecl, LabeledStmt, AssignStmt, Scope; or nil + Data any // object-specific data; or nil + Type any // placeholder for type information; may be nil } // NewObj creates a new object of a given kind and name. diff --git a/builtin/ng/big.go b/builtin/ng/big.go index 73a70a26b..00ebeee9a 100644 --- a/builtin/ng/big.go +++ b/builtin/ng/big.go @@ -20,7 +20,7 @@ import ( "math/big" ) -func Gop_istmp(a interface{}) bool { +func Gop_istmp(a any) bool { return false } diff --git a/cl/builtin_test.go b/cl/builtin_test.go index 88cd15e7c..0b4ad415f 100644 --- a/cl/builtin_test.go +++ b/cl/builtin_test.go @@ -455,7 +455,7 @@ func TestSpxRef(t *testing.T) { spxRef(pkg, "bar") } -func isError(e interface{}, msg string) bool { +func isError(e any, msg string) bool { if e != nil { if err, ok := e.(error); ok { return err.Error() == msg diff --git a/cl/compile.go b/cl/compile.go index 24e22e870..eb51ba2fd 100644 --- a/cl/compile.go +++ b/cl/compile.go @@ -409,11 +409,11 @@ func (p *pkgCtx) newCodeError(pos token.Pos, msg string) error { return &gogen.CodeError{Fset: p.nodeInterp, Pos: pos, Msg: msg} } -func (p *pkgCtx) newCodeErrorf(pos token.Pos, format string, args ...interface{}) error { +func (p *pkgCtx) newCodeErrorf(pos token.Pos, format string, args ...any) error { return &gogen.CodeError{Fset: p.nodeInterp, Pos: pos, Msg: fmt.Sprintf(format, args...)} } -func (p *pkgCtx) handleErrorf(pos token.Pos, format string, args ...interface{}) { +func (p *pkgCtx) handleErrorf(pos token.Pos, format string, args ...any) { p.handleErr(p.newCodeErrorf(pos, format, args...)) } @@ -460,12 +460,12 @@ func (p *pkgCtx) loadSymbol(name string) bool { return false } -func (p *pkgCtx) handleRecover(e interface{}, src ast.Node) { +func (p *pkgCtx) handleRecover(e any, src ast.Node) { err := p.recoverErr(e, src) p.handleErr(err) } -func (p *pkgCtx) recoverErr(e interface{}, src ast.Node) error { +func (p *pkgCtx) recoverErr(e any, src ast.Node) error { err, ok := e.(error) if !ok { if src != nil { diff --git a/cl/internal/spx/game.go b/cl/internal/spx/game.go index e7672028f..d645abaa9 100644 --- a/cl/internal/spx/game.go +++ b/cl/internal/spx/game.go @@ -26,7 +26,7 @@ type Sound string type MyGame struct { } -func Gopt_MyGame_Main(game interface{}) { +func Gopt_MyGame_Main(game any) { } func (p *MyGame) Ls(n int) {} @@ -51,20 +51,20 @@ func (p *MyGame) Broadcast__0(msg string) { func (p *MyGame) Broadcast__1(msg string, wait bool) { } -func (p *MyGame) Broadcast__2(msg string, data interface{}, wait bool) { +func (p *MyGame) Broadcast__2(msg string, data any, wait bool) { } func (p *MyGame) Play(media string, wait ...bool) { } -func (p *MyGame) sendMessage(data interface{}) { +func (p *MyGame) sendMessage(data any) { } -func (p *MyGame) SendMessage(data interface{}) { +func (p *MyGame) SendMessage(data any) { p.sendMessage(data) } -func Gopt_MyGame_Run(game interface{}, resource string) error { +func Gopt_MyGame_Run(game any, resource string) error { return nil } diff --git a/cl/internal/spx/sprite.go b/cl/internal/spx/sprite.go index bdcf7c22d..a7d1eed96 100644 --- a/cl/internal/spx/sprite.go +++ b/cl/internal/spx/sprite.go @@ -33,7 +33,7 @@ func (p *Entry) Vector() *pkg.Vector { return &p.vec } -func (p *Sprite) SetCostume(costume interface{}) { +func (p *Sprite) SetCostume(costume any) { } func (p *Sprite) Say(msg string, secs ...float64) { @@ -47,38 +47,38 @@ type Mesher interface { Name() string } -func Gopt_Sprite_Clone__0(sprite interface{}) { +func Gopt_Sprite_Clone__0(sprite any) { } -func Gopt_Sprite_Clone__1(sprite interface{}, data interface{}) { +func Gopt_Sprite_Clone__1(sprite any, data any) { } -func Gopt_Sprite_OnKey__0(sprite interface{}, a string, fn func()) { +func Gopt_Sprite_OnKey__0(sprite any, a string, fn func()) { } -func Gopt_Sprite_OnKey__1(sprite interface{}, a string, fn func(key string)) { +func Gopt_Sprite_OnKey__1(sprite any, a string, fn func(key string)) { } -func Gopt_Sprite_OnKey__2(sprite interface{}, a []string, fn func()) { +func Gopt_Sprite_OnKey__2(sprite any, a []string, fn func()) { } -func Gopt_Sprite_OnKey__3(sprite interface{}, a []string, fn func(key string)) { +func Gopt_Sprite_OnKey__3(sprite any, a []string, fn func(key string)) { } -func Gopt_Sprite_OnKey__4(sprite interface{}, a []Mesher, fn func()) { +func Gopt_Sprite_OnKey__4(sprite any, a []Mesher, fn func()) { } -func Gopt_Sprite_OnKey__5(sprite interface{}, a []Mesher, fn func(key Mesher)) { +func Gopt_Sprite_OnKey__5(sprite any, a []Mesher, fn func(key Mesher)) { } -func Gopt_Sprite_OnKey__6(sprite interface{}, a []string, b []string, fn func(key string)) { +func Gopt_Sprite_OnKey__6(sprite any, a []string, b []string, fn func(key string)) { } -func Gopt_Sprite_OnKey__7(sprite interface{}, a []string, b []Mesher, fn func(key string)) { +func Gopt_Sprite_OnKey__7(sprite any, a []string, b []Mesher, fn func(key string)) { } -func Gopt_Sprite_OnKey__8(sprite interface{}, x int, y int) { +func Gopt_Sprite_OnKey__8(sprite any, x int, y int) { } -func Gopt_Sprite_OnKey2(sprite interface{}, a string, fn func(key string)) { +func Gopt_Sprite_OnKey2(sprite any, a string, fn func(key string)) { } diff --git a/cl/stmt.go b/cl/stmt.go index 48d92bb09..3f5f66e49 100644 --- a/cl/stmt.go +++ b/cl/stmt.go @@ -977,7 +977,7 @@ func compileType(ctx *blockCtx, t *ast.TypeSpec) { } type ( - valueMap map[interface{}][]valueType // underlying Go value -> valueType + valueMap map[any][]valueType // underlying Go value -> valueType valueType struct { pos token.Pos typ types.Type @@ -985,7 +985,7 @@ type ( ) // goVal returns the Go value for val, or nil. -func goVal(val constant.Value) interface{} { +func goVal(val constant.Value) any { // val should exist, but be conservative and check if val == nil { return nil diff --git a/cmd/internal/env/env.go b/cmd/internal/env/env.go index d5afc1f2b..b634b9547 100644 --- a/cmd/internal/env/env.go +++ b/cmd/internal/env/env.go @@ -64,7 +64,7 @@ func runCmd(_ *base.Command, args []string) { log.Fatalln("run go env failed:", err) } - var gopEnv map[string]interface{} + var gopEnv map[string]any if err := json.Unmarshal(stdout.Bytes(), &gopEnv); err != nil { log.Fatal("decode json of go env failed:", err) } @@ -82,7 +82,7 @@ func runCmd(_ *base.Command, args []string) { outputEnvVars(gopEnv, vars, *envJson) } -func outputEnvVars(gopEnv map[string]interface{}, vars []string, outputJson bool) { +func outputEnvVars(gopEnv map[string]any, vars []string, outputJson bool) { onlyValues := true if len(vars) == 0 { @@ -94,7 +94,7 @@ func outputEnvVars(gopEnv map[string]interface{}, vars []string, outputJson bool } sort.Strings(vars) } else { - newEnv := make(map[string]interface{}) + newEnv := make(map[string]any) for _, v := range vars { if value, ok := gopEnv[v]; ok { newEnv[v] = value diff --git a/cmd/internal/help/help.go b/cmd/internal/help/help.go index 77728cff6..16ab23aad 100644 --- a/cmd/internal/help/help.go +++ b/cmd/internal/help/help.go @@ -89,7 +89,7 @@ func (w *errWriter) Write(b []byte) (int, error) { } // tmpl executes the given template text on data, writing the result to w. -func tmpl(w io.Writer, text string, data interface{}) { +func tmpl(w io.Writer, text string, data any) { t := template.New("top") t.Funcs(template.FuncMap{"trim": strings.TrimSpace, "capitalize": capitalize}) template.Must(t.Parse(text)) diff --git a/cmd/internal/mod/mod.go b/cmd/internal/mod/mod.go index 296f7ecd5..cc6fd3e88 100644 --- a/cmd/internal/mod/mod.go +++ b/cmd/internal/mod/mod.go @@ -40,7 +40,7 @@ func check(err error) { } } -func fatal(msg interface{}) { +func fatal(msg any) { fmt.Fprintln(os.Stderr, msg) os.Exit(1) } diff --git a/demo/mixgo/a.go b/demo/mixgo/a.go index 46c3612e4..a31f737cf 100644 --- a/demo/mixgo/a.go +++ b/demo/mixgo/a.go @@ -2,7 +2,7 @@ package main import "fmt" -func p(a interface{}) { +func p(a any) { sayMix() fmt.Println("Hello,", a) } diff --git a/format/format.go b/format/format.go index 77d8075e1..d090b3f97 100644 --- a/format/format.go +++ b/format/format.go @@ -50,7 +50,7 @@ const parserMode = parser.ParseComments // // The function may return early (before the entire result is written) // and return a formatting error, for instance due to an incorrect AST. -func Node(dst io.Writer, fset *token.FileSet, node interface{}) error { +func Node(dst io.Writer, fset *token.FileSet, node any) error { // Determine if we have a complete source file (file != nil). var file *ast.File var cnode *printer.CommentedNode diff --git a/parser/fsx/memfs/fs.go b/parser/fsx/memfs/fs.go index 8a076fc1d..3876b3d4b 100644 --- a/parser/fsx/memfs/fs.go +++ b/parser/fsx/memfs/fs.go @@ -41,7 +41,7 @@ func (p *dirEntry) Info() (fs.FileInfo, error) { return p.FileInfo, nil } -func File(filename string, src interface{}) (f *FileFS, err error) { +func File(filename string, src any) (f *FileFS, err error) { var data []byte var info fs.DirEntry if src != nil { @@ -84,7 +84,7 @@ func (p *FileFS) Abs(path string) (string, error) { return path, nil } -func readSource(src interface{}) ([]byte, error) { +func readSource(src any) ([]byte, error) { switch s := src.(type) { case string: return []byte(s), nil diff --git a/parser/fsx/memfs/memfs.go b/parser/fsx/memfs/memfs.go index 75de1f6c1..a5c398f37 100644 --- a/parser/fsx/memfs/memfs.go +++ b/parser/fsx/memfs/memfs.go @@ -55,7 +55,7 @@ func (p *memFileInfo) IsDir() bool { return false } -func (p *memFileInfo) Sys() interface{} { +func (p *memFileInfo) Sys() any { return nil } diff --git a/parser/interface.go b/parser/interface.go index 831ac793c..a798f60f6 100644 --- a/parser/interface.go +++ b/parser/interface.go @@ -78,7 +78,7 @@ const ( // errors were found, the result is a partial AST (with ast.Bad* nodes // representing the fragments of erroneous source code). Multiple errors // are returned via a scanner.ErrorList which is sorted by source position. -func parseFile(fset *token.FileSet, filename string, src interface{}, mode Mode) (f *ast.File, err error) { +func parseFile(fset *token.FileSet, filename string, src any, mode Mode) (f *ast.File, err error) { if fset == nil { panic("parser.ParseFile: no token.FileSet provided (fset == nil)") } diff --git a/parser/parser.go b/parser/parser.go index 156abf674..3f25cfac0 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -149,7 +149,7 @@ func (p *parser) closeLabelScope() { p.labelScope = p.labelScope.Outer } -func (p *parser) declare(decl, data interface{}, scope *ast.Scope, kind ast.ObjKind, idents ...*ast.Ident) { +func (p *parser) declare(decl, data any, scope *ast.Scope, kind ast.ObjKind, idents ...*ast.Ident) { for _, ident := range idents { assert(ident.Obj == nil, "identifier already declared or resolved") obj := ast.NewObj(kind, ident.Name) @@ -241,7 +241,7 @@ func (p *parser) resolve(x ast.Expr) { // ---------------------------------------------------------------------------- // Parsing support -func (p *parser) printTrace(a ...interface{}) { +func (p *parser) printTrace(a ...any) { const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " const n = len(dots) pos := p.file.Position(p.pos) diff --git a/parser/parser_gop.go b/parser/parser_gop.go index 6309871b0..d32cc55d7 100644 --- a/parser/parser_gop.go +++ b/parser/parser_gop.go @@ -57,7 +57,7 @@ type FileSystem = fsx.FileSystem // Parse parses a single Go+ source file. The filename specifies the Go+ source file. // If the file couldn't be read, a nil map and the respective error are returned. -func Parse(fset *token.FileSet, filename string, src interface{}, mode Mode) (pkgs map[string]*ast.Package, err error) { +func Parse(fset *token.FileSet, filename string, src any, mode Mode) (pkgs map[string]*ast.Package, err error) { file, err := ParseFile(fset, filename, src, mode) if err != nil { return @@ -96,7 +96,7 @@ func ParseDirEx(fset *token.FileSet, path string, conf Config) (pkgs map[string] } // ParseEntry calls ParseFSEntry by passing a local filesystem. -func ParseEntry(fset *token.FileSet, filename string, src interface{}, conf Config) (f *ast.File, err error) { +func ParseEntry(fset *token.FileSet, filename string, src any, conf Config) (f *ast.File, err error) { return ParseFSEntry(fset, fsx.Local, filename, src, conf) } @@ -192,7 +192,7 @@ func ParseFSDir(fset *token.FileSet, fs FileSystem, dir string, conf Config) (pk // ParseFSEntry parses the source code of a single Go+ source file and returns the corresponding ast.File node. // Compared to ParseFSFile, ParseFSEntry detects fileKind by its filename. -func ParseFSEntry(fset *token.FileSet, fs FileSystem, filename string, src interface{}, conf Config) (f *ast.File, err error) { +func ParseFSEntry(fset *token.FileSet, fs FileSystem, filename string, src any, conf Config) (f *ast.File, err error) { fname := fs.Base(filename) ext := path.Ext(fname) var isProj, isClass, isNormalGox bool @@ -322,12 +322,12 @@ func ParseFSEntries(fset *token.FileSet, fs FileSystem, files []string, conf Con // ----------------------------------------------------------------------------- // ParseFile parses the source code of a single Go+ source file and returns the corresponding ast.File node. -func ParseFile(fset *token.FileSet, filename string, src interface{}, mode Mode) (f *ast.File, err error) { +func ParseFile(fset *token.FileSet, filename string, src any, mode Mode) (f *ast.File, err error) { return ParseFSFile(fset, fsx.Local, filename, src, mode) } // ParseFSFile parses the source code of a single Go+ source file and returns the corresponding ast.File node. -func ParseFSFile(fset *token.FileSet, fs FileSystem, filename string, src interface{}, mode Mode) (f *ast.File, err error) { +func ParseFSFile(fset *token.FileSet, fs FileSystem, filename string, src any, mode Mode) (f *ast.File, err error) { code, err := readSourceFS(fs, filename, src) if err != nil { return @@ -338,7 +338,7 @@ func ParseFSFile(fset *token.FileSet, fs FileSystem, filename string, src interf return parseFile(fset, filename, code, mode) } -func readSourceFS(fs FileSystem, filename string, src interface{}) ([]byte, error) { +func readSourceFS(fs FileSystem, filename string, src any) ([]byte, error) { if src != nil { return iox.ReadSource(src) } diff --git a/parser/parser_test.go b/parser/parser_test.go index 3a67a4571..9172c33d2 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -64,7 +64,7 @@ func TestAssert(t *testing.T) { assert(false, "panic msg") } -func panicMsg(e interface{}) string { +func panicMsg(e any) string { switch v := e.(type) { case string: return v diff --git a/parser/parserdir_test.go b/parser/parserdir_test.go index 85b0f9c98..a49f24873 100644 --- a/parser/parserdir_test.go +++ b/parser/parserdir_test.go @@ -160,7 +160,7 @@ func TestParseEntries_SaveAbsFile(t *testing.T) { } func doTestParseEntries(t *testing.T, confReal Config) { - doTestParseEntry(t, func(fset *token.FileSet, filename string, src interface{}, conf Config) (f *ast.File, err error) { + doTestParseEntry(t, func(fset *token.FileSet, filename string, src any, conf Config) (f *ast.File, err error) { fs, _ := memfs.File(filename, src) pkgs, err := ParseFSEntries(fset, fs, []string{filename}, confReal) if err != nil { @@ -181,7 +181,7 @@ func TestParseEntry(t *testing.T) { doTestParseEntry(t, ParseEntry) } -func doTestParseEntry(t *testing.T, parseEntry func(fset *token.FileSet, filename string, src interface{}, conf Config) (f *ast.File, err error)) { +func doTestParseEntry(t *testing.T, parseEntry func(fset *token.FileSet, filename string, src any, conf Config) (f *ast.File, err error)) { fset := token.NewFileSet() src, err := os.ReadFile("./_testdata/functype/functype.go") if err != nil { diff --git a/parser/parsertest/parsertest.go b/parser/parsertest/parsertest.go index def8c1330..ac94bb9f3 100644 --- a/parser/parsertest/parsertest.go +++ b/parser/parsertest/parsertest.go @@ -31,7 +31,7 @@ import ( "github.com/goplus/gop/token" ) -func sortedKeys(m interface{}) []string { +func sortedKeys(m any) []string { iter := reflect.ValueOf(m).MapRange() keys := make([]string, 0, 8) for iter.Next() { @@ -50,7 +50,7 @@ var ( ) // FprintNode prints a Go+ AST node. -func FprintNode(w io.Writer, lead string, v interface{}, prefix, indent string) { +func FprintNode(w io.Writer, lead string, v any, prefix, indent string) { val := reflect.ValueOf(v) switch val.Kind() { case reflect.Slice: diff --git a/printer/printer.go b/printer/printer.go index fbc3a266b..cdae72734 100644 --- a/printer/printer.go +++ b/printer/printer.go @@ -116,7 +116,7 @@ func (p *printer) init(cfg *Config, fset *token.FileSet, nodeSizes map[ast.Node] p.cachedPos = -1 } -func (p *printer) internalError(msg ...interface{}) { +func (p *printer) internalError(msg ...any) { if debug { fmt.Print(p.pos.String() + ": ") fmt.Println(msg...) @@ -889,7 +889,7 @@ func (p *printer) setPos(pos token.Pos) { // taking into account the amount and structure of any pending white- // space for best comment placement. Then, any leftover whitespace is // printed, followed by the actual token. -func (p *printer) print(args ...interface{}) { +func (p *printer) print(args ...any) { for _, arg := range args { // information about the current arg var data string @@ -1085,7 +1085,7 @@ func getLastComment(n ast.Node) *ast.CommentGroup { return nil } -func (p *printer) printNode(node interface{}) error { +func (p *printer) printNode(node any) error { // unpack *CommentedNode, if any var comments []*ast.CommentGroup if cnode, ok := node.(*CommentedNode); ok { @@ -1300,7 +1300,7 @@ type Config struct { } // fprint implements Fprint and takes a nodesSizes map for setting up the printer state. -func (cfg *Config) fprint(output io.Writer, fset *token.FileSet, node interface{}, nodeSizes map[ast.Node]int) (err error) { +func (cfg *Config) fprint(output io.Writer, fset *token.FileSet, node any, nodeSizes map[ast.Node]int) (err error) { // print node var p printer p.init(cfg, fset, nodeSizes) @@ -1351,7 +1351,7 @@ func (cfg *Config) fprint(output io.Writer, fset *token.FileSet, node interface{ // A CommentedNode bundles an AST node and corresponding comments. // It may be provided as argument to any of the Fprint functions. type CommentedNode struct { - Node interface{} // *ast.File, or ast.Expr, ast.Decl, ast.Spec, or ast.Stmt + Node any // *ast.File, or ast.Expr, ast.Decl, ast.Spec, or ast.Stmt Comments []*ast.CommentGroup } @@ -1359,7 +1359,7 @@ type CommentedNode struct { // Position information is interpreted relative to the file set fset. // The node type must be *ast.File, *CommentedNode, []ast.Decl, []ast.Stmt, // or assignment-compatible to ast.Expr, ast.Decl, ast.Spec, or ast.Stmt. -func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node interface{}) error { +func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node any) error { return cfg.fprint(output, fset, node, make(map[ast.Node]int)) } @@ -1367,6 +1367,6 @@ func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node interface{ // It calls Config.Fprint with default settings. // Note that gofmt uses tabs for indentation but spaces for alignment; // use format.Node (package go/format) for output that matches gofmt. -func Fprint(output io.Writer, fset *token.FileSet, node interface{}) error { +func Fprint(output io.Writer, fset *token.FileSet, node any) error { return (&Config{Tabwidth: 8}).Fprint(output, fset, node) } diff --git a/scanner/scanner.go b/scanner/scanner.go index 1994eb8c7..962e71502 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -170,7 +170,7 @@ func (s *Scanner) error(offs int, msg string) { s.ErrorCount++ } -func (s *Scanner) errorf(offs int, format string, args ...interface{}) { +func (s *Scanner) errorf(offs int, format string, args ...any) { s.error(offs, fmt.Sprintf(format, args...)) } diff --git a/x/build/build.go b/x/build/build.go index c5d5eeadc..5407d2cb2 100644 --- a/x/build/build.go +++ b/x/build/build.go @@ -141,7 +141,7 @@ func (c *Context) ParseFSDir(fs parser.FileSystem, dir string) (*Package, error) return c.loadPackage(dir, pkgs) } -func (c *Context) ParseFile(file string, src interface{}) (*Package, error) { +func (c *Context) ParseFile(file string, src any) (*Package, error) { fs, err := memfs.File(file, src) if err != nil { return nil, err @@ -173,7 +173,7 @@ func (c *Context) loadPackage(srcDir string, pkgs map[string]*ast.Package) (*Pac return &Package{c.fset, out}, nil } -func (ctx *Context) BuildFile(filename string, src interface{}) (data []byte, err error) { +func (ctx *Context) BuildFile(filename string, src any) (data []byte, err error) { defer func() { r := recover() if r != nil { diff --git a/x/build/build_test.go b/x/build/build_test.go index ea82939ab..1bebeca94 100644 --- a/x/build/build_test.go +++ b/x/build/build_test.go @@ -47,11 +47,11 @@ func init() { build.RegisterClassFileType("_yap.gox", "App", nil, "github.com/goplus/yap") } -func gopClTest(t *testing.T, gopcode interface{}, expected string) { +func gopClTest(t *testing.T, gopcode any, expected string) { gopClTestEx(t, "main.gop", gopcode, expected) } -func gopClTestEx(t *testing.T, filename string, gopcode interface{}, expected string) { +func gopClTestEx(t *testing.T, filename string, gopcode any, expected string) { data, err := ctx.BuildFile(filename, gopcode) if err != nil { t.Fatalf("build gop error: %v", err) diff --git a/x/jsonrpc2/conn.go b/x/jsonrpc2/conn.go index cf31d118f..937479d33 100644 --- a/x/jsonrpc2/conn.go +++ b/x/jsonrpc2/conn.go @@ -275,7 +275,7 @@ func newConnection(bindCtx context.Context, rwc io.ReadWriteCloser, binder Binde // Notify invokes the target method but does not wait for a response. // The params will be marshaled to JSON before sending over the wire, and will // be handed to the method invoked. -func (c *Connection) Notify(ctx context.Context, method string, params interface{}) (err error) { +func (c *Connection) Notify(ctx context.Context, method string, params any) (err error) { attempted := false defer func() { @@ -325,7 +325,7 @@ func (c *Connection) Notify(ctx context.Context, method string, params interface // be handed to the method invoked. // You do not have to wait for the response, it can just be ignored if not needed. // If sending the call failed, the response will be ready and have the error in it. -func (c *Connection) Call(ctx context.Context, method string, params interface{}) *AsyncCall { +func (c *Connection) Call(ctx context.Context, method string, params any) *AsyncCall { if debugCall { log.Println("Call", method, "params:", params) } @@ -417,7 +417,7 @@ func (ac *AsyncCall) retire(response *Response) { // Await waits for (and decodes) the results of a Call. // The response will be unmarshaled from JSON into the result. -func (ac *AsyncCall) Await(ctx context.Context, result interface{}) error { +func (ac *AsyncCall) Await(ctx context.Context, result any) error { if Verbose { log.Println("==> AsyncCall.Await", ac.id) } @@ -446,7 +446,7 @@ func (ac *AsyncCall) Await(ctx context.Context, result interface{}) error { // // Respond must be called exactly once for any message for which a handler // returns ErrAsyncResponse. It must not be called for any other message. -func (c *Connection) Respond(id ID, result interface{}, err error) error { +func (c *Connection) Respond(id ID, result any, err error) error { var req *incomingRequest c.updateInFlight(func(s *inFlightState) { req = s.incomingByID[id] @@ -705,7 +705,7 @@ func (c *Connection) handleAsync() { } // processResult processes the result of a request and, if appropriate, sends a response. -func (c *Connection) processResult(from interface{}, req *incomingRequest, result interface{}, err error) error { +func (c *Connection) processResult(from any, req *incomingRequest, result any, err error) error { switch err { case ErrAsyncResponse: if !req.IsCall() { @@ -794,7 +794,7 @@ func (c *Connection) write(ctx context.Context, msg Message) error { // internalErrorf reports an internal error. By default it panics, but if // c.onInternalError is non-nil it instead calls that and returns an error // wrapping ErrInternal. -func (c *Connection) internalErrorf(format string, args ...interface{}) error { +func (c *Connection) internalErrorf(format string, args ...any) error { err := fmt.Errorf(format, args...) c.onInternalError(err) @@ -804,7 +804,7 @@ func (c *Connection) internalErrorf(format string, args ...interface{}) error { // notDone is a context.Context wrapper that returns a nil Done channel. type notDone struct{ ctx context.Context } -func (ic notDone) Value(key interface{}) interface{} { +func (ic notDone) Value(key any) any { return ic.ctx.Value(key) } diff --git a/x/jsonrpc2/jsonrpc2.go b/x/jsonrpc2/jsonrpc2.go index 8c7583891..ed3a09e65 100644 --- a/x/jsonrpc2/jsonrpc2.go +++ b/x/jsonrpc2/jsonrpc2.go @@ -79,13 +79,13 @@ type Preempter interface { // Otherwise, the result and error are processed as if returned by Handle. // // Preempt must not block. (The Context passed to it is for Values only.) - Preempt(ctx context.Context, req *Request) (result interface{}, err error) + Preempt(ctx context.Context, req *Request) (result any, err error) } // A PreempterFunc implements the Preempter interface for a standalone Preempt function. -type PreempterFunc func(ctx context.Context, req *Request) (interface{}, error) +type PreempterFunc func(ctx context.Context, req *Request) (any, error) -func (f PreempterFunc) Preempt(ctx context.Context, req *Request) (interface{}, error) { +func (f PreempterFunc) Preempt(ctx context.Context, req *Request) (any, error) { return f(ctx, req) } @@ -106,23 +106,23 @@ type Handler interface { // connection is broken or the request is canceled or completed. // (If Handle returns ErrAsyncResponse, ctx will remain uncanceled // until either Cancel or Respond is called for the request's ID.) - Handle(ctx context.Context, req *Request) (result interface{}, err error) + Handle(ctx context.Context, req *Request) (result any, err error) } type defaultHandler struct{} -func (defaultHandler) Preempt(context.Context, *Request) (interface{}, error) { +func (defaultHandler) Preempt(context.Context, *Request) (any, error) { return nil, ErrNotHandled } -func (defaultHandler) Handle(context.Context, *Request) (interface{}, error) { +func (defaultHandler) Handle(context.Context, *Request) (any, error) { return nil, ErrNotHandled } // A HandlerFunc implements the Handler interface for a standalone Handle function. -type HandlerFunc func(ctx context.Context, req *Request) (interface{}, error) +type HandlerFunc func(ctx context.Context, req *Request) (any, error) -func (f HandlerFunc) Handle(ctx context.Context, req *Request) (interface{}, error) { +func (f HandlerFunc) Handle(ctx context.Context, req *Request) (any, error) { return f(ctx, req) } diff --git a/x/jsonrpc2/jsonrpc2test/cases/testcase.go b/x/jsonrpc2/jsonrpc2test/cases/testcase.go index 886d6537e..ef277554e 100644 --- a/x/jsonrpc2/jsonrpc2test/cases/testcase.go +++ b/x/jsonrpc2/jsonrpc2test/cases/testcase.go @@ -92,24 +92,24 @@ type invoker interface { type notify struct { method string - params interface{} + params any } type call struct { method string - params interface{} - expect interface{} + params any + expect any } type async struct { name string method string - params interface{} + params any } type collect struct { name string - expect interface{} + expect any fails bool } @@ -175,7 +175,7 @@ func (test call) Invoke(t *testing.T, ctx context.Context, h *handler) { func (test echo) Invoke(t *testing.T, ctx context.Context, h *handler) { results := newResults(test.expect) - if err := h.conn.Call(ctx, "echo", []interface{}{test.method, test.params}).Await(ctx, results); err != nil { + if err := h.conn.Call(ctx, "echo", []any{test.method, test.params}).Await(ctx, results); err != nil { t.Fatalf("%v:Echo failed: %v", test.method, err) } verifyResults(t, test.method, results, test.expect) @@ -216,10 +216,10 @@ func (test sequence) Invoke(t *testing.T, ctx context.Context, h *handler) { } // newResults makes a new empty copy of the expected type to put the results into -func newResults(expect interface{}) interface{} { +func newResults(expect any) any { switch e := expect.(type) { - case []interface{}: - var r []interface{} + case []any: + var r []any for _, v := range e { r = append(r, reflect.New(reflect.TypeOf(v)).Interface()) } @@ -232,7 +232,7 @@ func newResults(expect interface{}) interface{} { } // verifyResults compares the results to the expected values -func verifyResults(t *testing.T, method string, results interface{}, expect interface{}) { +func verifyResults(t *testing.T, method string, results any, expect any) { if expect == nil { if results != nil { t.Errorf("%v:Got results %+v where none expeted", method, expect) @@ -288,7 +288,7 @@ func (h *handler) tryCloseWaiter(name string) (ok bool) { return } -func (h *handler) Preempt(ctx context.Context, req *jsonrpc2.Request) (interface{}, error) { +func (h *handler) Preempt(ctx context.Context, req *jsonrpc2.Request) (any, error) { switch req.Method { case "unblock": var name string @@ -314,7 +314,7 @@ func (h *handler) Preempt(ctx context.Context, req *jsonrpc2.Request) (interface } } -func (h *handler) Handle(ctx context.Context, req *jsonrpc2.Request) (interface{}, error) { +func (h *handler) Handle(ctx context.Context, req *jsonrpc2.Request) (any, error) { switch req.Method { case "no_args": if len(req.Params) > 0 { @@ -359,11 +359,11 @@ func (h *handler) Handle(ctx context.Context, req *jsonrpc2.Request) (interface{ } return path.Join(v...), nil case "echo": - var v []interface{} + var v []any if err := json.Unmarshal(req.Params, &v); err != nil { return nil, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) } - var result interface{} + var result any err := h.conn.Call(ctx, v[0].(string), v[1]).Await(ctx, &result) return result, err case "wait": diff --git a/x/jsonrpc2/messages.go b/x/jsonrpc2/messages.go index 509f607b1..1067544d0 100644 --- a/x/jsonrpc2/messages.go +++ b/x/jsonrpc2/messages.go @@ -28,7 +28,7 @@ import ( // ID is a Request identifier. type ID struct { - value interface{} + value any } // Message is the interface to all jsonrpc2 message types. @@ -75,18 +75,18 @@ func Int64ID(i int64) ID { return ID{value: i} } func (id ID) IsValid() bool { return id.value != nil } // Raw returns the underlying value of the ID. -func (id ID) Raw() interface{} { return id.value } +func (id ID) Raw() any { return id.value } // NewNotification constructs a new Notification message for the supplied // method and parameters. -func NewNotification(method string, params interface{}) (*Request, error) { +func NewNotification(method string, params any) (*Request, error) { p, merr := marshalToRaw(params) return &Request{Method: method, Params: p}, merr } // NewCall constructs a new Call message for the supplied ID, method and // parameters. -func NewCall(id ID, method string, params interface{}) (*Request, error) { +func NewCall(id ID, method string, params any) (*Request, error) { p, merr := marshalToRaw(params) return &Request{ID: id, Method: method, Params: p}, merr } @@ -101,7 +101,7 @@ func (msg *Request) marshal(to *wireCombined) { // NewResponse constructs a new Response message that is a reply to the // supplied. If err is set result may be ignored. -func NewResponse(id ID, result interface{}, rerr error) (*Response, error) { +func NewResponse(id ID, result any, rerr error) (*Response, error) { r, merr := marshalToRaw(result) return &Response{ID: id, Result: r, Error: rerr}, merr } @@ -185,7 +185,7 @@ func DecodeMessage(data []byte) (Message, error) { return resp, nil } -func marshalToRaw(obj interface{}) (json.RawMessage, error) { +func marshalToRaw(obj any) (json.RawMessage, error) { if obj == nil { return nil, nil } diff --git a/x/jsonrpc2/wire.go b/x/jsonrpc2/wire.go index 317b65980..4a9d29679 100644 --- a/x/jsonrpc2/wire.go +++ b/x/jsonrpc2/wire.go @@ -61,7 +61,7 @@ const wireVersion = "2.0" // We can decode this and then work out which it is. type wireCombined struct { VersionTag string `json:"jsonrpc"` - ID interface{} `json:"id,omitempty"` + ID any `json:"id,omitempty"` Method string `json:"method,omitempty"` Params json.RawMessage `json:"params,omitempty"` Result json.RawMessage `json:"result,omitempty"` diff --git a/x/langserver/server.go b/x/langserver/server.go index 47de37cbc..d69dfc542 100644 --- a/x/langserver/server.go +++ b/x/langserver/server.go @@ -113,7 +113,7 @@ func (p *handler) Changed(files []string) { } } -func (p *handler) Handle(ctx context.Context, req *jsonrpc2.Request) (result interface{}, err error) { +func (p *handler) Handle(ctx context.Context, req *jsonrpc2.Request) (result any, err error) { switch req.Method { case methodChanged: var files []string diff --git a/x/typesutil/check_test.go b/x/typesutil/check_test.go index 07da84462..888c0a8c1 100644 --- a/x/typesutil/check_test.go +++ b/x/typesutil/check_test.go @@ -25,7 +25,7 @@ func init() { typesutil.SetDebug(typesutil.DbgFlagDefault) } -func loadFiles(fset *token.FileSet, file string, src interface{}, goxfile string, goxsrc interface{}, gofile string, gosrc interface{}) ([]*ast.File, []*goast.File, error) { +func loadFiles(fset *token.FileSet, file string, src any, goxfile string, goxsrc any, gofile string, gosrc any) ([]*ast.File, []*goast.File, error) { var files []*ast.File var gofiles []*goast.File if file != "" { @@ -52,7 +52,7 @@ func loadFiles(fset *token.FileSet, file string, src interface{}, goxfile string return files, gofiles, nil } -func checkFiles(fset *token.FileSet, file string, src interface{}, goxfile string, goxsrc interface{}, gofile string, gosrc interface{}) (*typesutil.Info, *types.Info, error) { +func checkFiles(fset *token.FileSet, file string, src any, goxfile string, goxsrc any, gofile string, gosrc any) (*typesutil.Info, *types.Info, error) { files, gofiles, err := loadFiles(fset, file, src, goxfile, goxsrc, gofile, gosrc) if err != nil { return nil, nil, err diff --git a/x/typesutil/info_test.go b/x/typesutil/info_test.go index 5f34a42b9..36e132d62 100644 --- a/x/typesutil/info_test.go +++ b/x/typesutil/info_test.go @@ -106,7 +106,7 @@ func parseMixedSource(mod *gopmod.Module, fset *token.FileSet, name, src string, return chkOpts.Types, info, ginfo, err } -func parseSource(fset *token.FileSet, filename string, src interface{}, mode parser.Mode) (*types.Package, *typesutil.Info, error) { +func parseSource(fset *token.FileSet, filename string, src any, mode parser.Mode) (*types.Package, *typesutil.Info, error) { f, err := parser.ParseEntry(fset, filename, src, parser.Config{ Mode: mode, }) @@ -136,7 +136,7 @@ func parseSource(fset *token.FileSet, filename string, src interface{}, mode par return pkg, info, err } -func parseGoSource(fset *token.FileSet, filename string, src interface{}, mode goparser.Mode) (*types.Package, *types.Info, error) { +func parseGoSource(fset *token.FileSet, filename string, src any, mode goparser.Mode) (*types.Package, *types.Info, error) { f, err := goparser.ParseFile(fset, filename, src, mode) if err != nil { return nil, nil, err @@ -190,7 +190,7 @@ func testGopInfoEx(t *testing.T, mod *gopmod.Module, name string, src string, go } } -func testInfo(t *testing.T, src interface{}) { +func testInfo(t *testing.T, src any) { fset := token.NewFileSet() _, info, err := parseSource(fset, "main.gop", src, parser.ParseComments) if err != nil { From 48aac448bf50c33aa462cab627dac18ba0b45e8c Mon Sep 17 00:00:00 2001 From: xushiwei Date: Fri, 14 Mar 2025 01:58:46 +0800 Subject: [PATCH 2/2] typesutil/info_test --- x/typesutil/info_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x/typesutil/info_test.go b/x/typesutil/info_test.go index 36e132d62..600753988 100644 --- a/x/typesutil/info_test.go +++ b/x/typesutil/info_test.go @@ -1693,14 +1693,14 @@ func onCloned() { 008: 8: 4 | int *ast.Ident | type : int | type 009: 12: 2 | a *ast.Ident | var : int | variable 010: 12: 6 | 1 *ast.BasicLit | value : untyped int = 1 | constant -011: 13: 2 | clone *ast.Ident | value : func(sprite interface{}) | value -012: 14: 2 | clone *ast.Ident | value : func(sprite interface{}, data interface{}) | value +011: 13: 2 | clone *ast.Ident | value : func(sprite any) | value +012: 14: 2 | clone *ast.Ident | value : func(sprite any, data any) | value 013: 14: 2 | clone info{1, 2} *ast.CallExpr | void : () | no value 014: 14: 8 | info *ast.Ident | type : main.info | type 015: 14: 8 | info{1, 2} *ast.CompositeLit | value : main.info | value 016: 14:13 | 1 *ast.BasicLit | value : untyped int = 1 | constant 017: 14:15 | 2 *ast.BasicLit | value : untyped int = 2 | constant -018: 15: 2 | clone *ast.Ident | value : func(sprite interface{}, data interface{}) | value +018: 15: 2 | clone *ast.Ident | value : func(sprite any, data any) | value 019: 15: 2 | clone &info{1, 2} *ast.CallExpr | void : () | no value 020: 15: 8 | &info{1, 2} *ast.UnaryExpr | value : *main.info | value 021: 15: 9 | info *ast.Ident | type : main.info | type @@ -1728,10 +1728,10 @@ func onCloned() { 004: 7: 4 | int | type int 005: 8: 4 | int | type int 006: 12: 2 | a | field a int -007: 13: 2 | clone | func github.com/goplus/gop/cl/internal/spx.Gopt_Sprite_Clone__0(sprite interface{}) -008: 14: 2 | clone | func github.com/goplus/gop/cl/internal/spx.Gopt_Sprite_Clone__1(sprite interface{}, data interface{}) +007: 13: 2 | clone | func github.com/goplus/gop/cl/internal/spx.Gopt_Sprite_Clone__0(sprite any) +008: 14: 2 | clone | func github.com/goplus/gop/cl/internal/spx.Gopt_Sprite_Clone__1(sprite any, data any) 009: 14: 8 | info | type main.info struct{x int; y int} -010: 15: 2 | clone | func github.com/goplus/gop/cl/internal/spx.Gopt_Sprite_Clone__1(sprite interface{}, data interface{}) +010: 15: 2 | clone | func github.com/goplus/gop/cl/internal/spx.Gopt_Sprite_Clone__1(sprite any, data any) 011: 15: 9 | info | type main.info struct{x int; y int} 012: 19: 2 | say | func (*github.com/goplus/gop/cl/internal/spx.Sprite).Say(msg string, secs ...float64) == overloads ==