Go version

go version go1.25rc1 linux/amd64

Output of go env in your module/workspace:

.

What did you do?

package main

import (
    "go/ast"
    "go/parser"
    "go/token"
    "go/types"
    "log"
)

func main() {
    src := `
    package p
    type I interface { M(int) string }
    `
    fset := token.NewFileSet()
    f, err := parser.ParseFile(fset, "p.go", src, 0)
    if err != nil {
        log.Fatal(err)
    }

    conf := types.Config{Importer: nil}
    info := &types.Info{Types: make(map[ast.Expr]types.TypeAndValue)}
    _, err = conf.Check("p", fset, []*ast.File{f}, info)
    if err != nil {
        log.Fatal(err)
    }

    ast.Inspect(f, func(n ast.Node) bool {
        if iface, ok := n.(*ast.InterfaceType); ok {
            for i, m := range iface.Methods.List {
                typ := info.TypeOf(m.Type)
                log.Printf("Method %d Type: %v", i, typ)
            }
        }
        return true
    })
}

What did you see happen?

non-nil method type (as Go versions before 1.25)

What did you expect to see?

nil method type.

(I'm not sure if this is a bug. Maybe something changed in Go 1.25.)

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: adonovan

I confirm that this is a go1.25 behavior change. Next step: bisect the history of go/types.