name := f.Name.Value
if name == "_" {
check.error(f.Name, BlankIfaceMethod, "methods must have a unique non-blank name")
- continue // ignore method
+ continue // ignore
}
- // Type-check method declaration.
- // Note: Don't call check.typ(f.Type) as that would record
- // the method incorrectly as a type expression in Info.Types.
- ftyp, _ := f.Type.(*syntax.FuncType)
- if ftyp == nil {
- check.errorf(f.Type, InvalidSyntaxTree, "%s is not a method signature", f.Type)
- continue // ignore method
+ typ := check.typ(f.Type)
+ sig, _ := typ.(*Signature)
+ if sig == nil {
+ if isValid(typ) {
+ check.errorf(f.Type, InvalidSyntaxTree, "%s is not a method signature", typ)
+ }
+ continue // ignore
}
- sig := new(Signature)
- check.funcType(sig, nil, nil, ftyp)
// use named receiver type if available (for better error messages)
var recvTyp Type = ityp
name := f.Names[0]
if name.Name == "_" {
check.error(name, BlankIfaceMethod, "methods must have a unique non-blank name")
- continue // ignore method
+ continue // ignore
}
- // Type-check method declaration.
- // Note: Don't call check.typ(f.Type) as that would record
- // the method incorrectly as a type expression in Info.Types.
- ftyp, _ := f.Type.(*ast.FuncType)
- if ftyp == nil {
- check.errorf(f.Type, InvalidSyntaxTree, "%s is not a method signature", f.Type)
- continue // ignore method
+ typ := check.typ(f.Type)
+ sig, _ := typ.(*Signature)
+ if sig == nil {
+ if isValid(typ) {
+ check.errorf(f.Type, InvalidSyntaxTree, "%s is not a method signature", typ)
+ }
+ continue // ignore
}
- sig := new(Signature)
- check.funcType(sig, nil, ftyp)
// The go/parser doesn't accept method type parameters but an ast.FuncType may have them.
if sig.tparams != nil {