@@ -60,7 +60,7 @@ func (check *Checker) infer(pos syntax.Pos, tparams []*TypeParam, targs []Type,
60
60
// If we have type arguments, see how far we get with constraint type inference.
61
61
if len (targs ) > 0 && useConstraintTypeInference {
62
62
var index int
63
- targs , index = check .inferB (tparams , targs )
63
+ targs , index = check .inferB (pos , tparams , targs )
64
64
if targs == nil || index < 0 {
65
65
return targs
66
66
}
@@ -171,7 +171,7 @@ func (check *Checker) infer(pos syntax.Pos, tparams []*TypeParam, targs []Type,
171
171
// Note that even if we don't have any type arguments, constraint type inference
172
172
// may produce results for constraints that explicitly specify a type.
173
173
if useConstraintTypeInference {
174
- targs , index = check .inferB (tparams , targs )
174
+ targs , index = check .inferB (pos , tparams , targs )
175
175
if targs == nil || index < 0 {
176
176
return targs
177
177
}
@@ -209,7 +209,7 @@ func (check *Checker) infer(pos syntax.Pos, tparams []*TypeParam, targs []Type,
209
209
210
210
// Again, follow up with constraint type inference.
211
211
if useConstraintTypeInference {
212
- targs , index = check .inferB (tparams , targs )
212
+ targs , index = check .inferB (pos , tparams , targs )
213
213
if targs == nil || index < 0 {
214
214
return targs
215
215
}
@@ -360,7 +360,7 @@ func (w *tpWalker) isParameterizedTypeList(list []Type) bool {
360
360
// first type argument in that list that couldn't be inferred (and thus is nil). If all
361
361
// type arguments were inferred successfully, index is < 0. The number of type arguments
362
362
// provided may be less than the number of type parameters, but there must be at least one.
363
- func (check * Checker ) inferB (tparams []* TypeParam , targs []Type ) (types []Type , index int ) {
363
+ func (check * Checker ) inferB (pos syntax. Pos , tparams []* TypeParam , targs []Type ) (types []Type , index int ) {
364
364
assert (len (tparams ) >= len (targs ) && len (targs ) > 0 )
365
365
366
366
// Setup bidirectional unification between constraints
@@ -388,7 +388,7 @@ func (check *Checker) inferB(tparams []*TypeParam, targs []Type) (types []Type,
388
388
if ! u .unify (tpar , sbound ) {
389
389
// TODO(gri) improve error message by providing the type arguments
390
390
// which we know already
391
- check .errorf (tpar . obj , "%s does not match %s" , tpar , sbound )
391
+ check .errorf (pos , "%s does not match %s" , tpar , sbound )
392
392
return nil , 0
393
393
}
394
394
}
0 commit comments