}
// x.(type) expressions are handled explicitly in type switches
if e.Type == nil {
- // Don't use invalidAST because this can occur in the AST produced by
+ // Don't use InvalidSyntaxTree because this can occur in the AST produced by
// go/parser.
check.error(e, BadTypeKeyword, "use of .(type) outside type switch")
goto Error
continue // ignore
}
- // Always type-check method type parameters but complain if they are not enabled.
- // (This extra check is needed here because interface method signatures don't have
- // a receiver specification.)
+ // The go/parser doesn't accept method type parameters but an ast.FuncType may have them.
if sig.tparams != nil {
var at positioner = f.Type
if ftyp, _ := f.Type.(*ast.FuncType); ftyp != nil && ftyp.TypeParams != nil {
at = ftyp.TypeParams
}
- check.error(at, InvalidMethodTypeParams, "methods cannot have type parameters")
+ check.error(at, InvalidSyntaxTree, "methods cannot have type parameters")
}
// use named receiver type if available (for better error messages)