mirror of https://github.com/golang/go.git
go/types: minor adjustment to an error message and comments
Change-Id: Ie9505d508507c9ed764ec725df1027c92bae0702
This commit is contained in:
parent
e70e49973e
commit
3ab56f5ff2
|
|
@ -73,9 +73,11 @@ func (check *Checker) infer(pos token.Pos, tparams []*TypeName, params *Tuple, a
|
|||
// infer an untyped nil type as type parameter type. Ignore untyped
|
||||
// nil by making sure all default argument types are typed.
|
||||
if isTyped(targ) && !check.identical0(par.typ, targ, true, nil, targs) {
|
||||
check.errorf(arg.pos(), "default type %s for %s does not match %s = %s",
|
||||
Default(arg.typ), arg.expr, par.typ, check.subst(pos, par.typ, tparams, targs),
|
||||
)
|
||||
// TODO(gri) see TODO comment above
|
||||
// check.errorf(arg.pos(), "default type %s for %s does not match %s = %s",
|
||||
// Default(arg.typ), arg.expr, par.typ, check.subst(pos, par.typ, tparams, targs),
|
||||
// )
|
||||
check.errorf(arg.pos(), "default type %s for %s does not match %s", Default(arg.typ), arg.expr, par.typ)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -362,14 +362,14 @@ func (check *Checker) missingMethod(V Type, T *Interface, static bool) (method,
|
|||
// does not instantiate the methods).
|
||||
// In order to compare the signatures, substitute the receiver
|
||||
// type parameters of ftyp with V's instantiation type arguments.
|
||||
// This lazily instantiates the method f.
|
||||
if Vn != nil {
|
||||
// This lazily instantiates the signature of method f.
|
||||
if Vn != nil && len(Vn.targs) > 0 {
|
||||
ftyp = check.subst(token.NoPos, ftyp, ftyp.rparams, Vn.targs).(*Signature)
|
||||
}
|
||||
|
||||
// If the methods have type parameters we don't care whether they
|
||||
// are the same or not, as long as they match up. Use inference
|
||||
// comparison in that case.
|
||||
// comparison (provide non-nil tparams to identical0) in that case.
|
||||
// TODO(gri) is this always correct? what about type bounds?
|
||||
// (Alternative is to rename/subst type parameters and compare.)
|
||||
var tparams []Type
|
||||
|
|
|
|||
Loading…
Reference in New Issue