@@ -5,6 +5,7 @@ package gogen
5
5
6
6
import (
7
7
"fmt"
8
+ "go/token"
8
9
"go/types"
9
10
_ "unsafe"
10
11
)
@@ -42,12 +43,12 @@ type error_ struct {
42
43
//go:linkname checker_infer123 go/types.(*Checker).infer
43
44
func checker_infer123 (check * types.Checker , posn positioner , tparams []* types.TypeParam , targs []types.Type , params * Tuple , args []* operand , reverse bool , err * error_ ) (inferred []types.Type )
44
45
45
- func checker_infer (check * types.Checker , posn positioner , tparams []* types.TypeParam , targs []types.Type , params * types.Tuple , args []* operand ) (result []types.Type , err error ) {
46
+ func checker_infer (check * types.Checker , conf * types. Config , fset * token. FileSet , posn positioner , tparams []* types.TypeParam , targs []types.Type , params * types.Tuple , args []* operand ) (result []types.Type ) {
46
47
const CannotInferTypeArgs = 138
47
- _err := & error_ {check : check , code : CannotInferTypeArgs }
48
- result = checker_infer123 (check , posn , tparams , targs , params , args , true , _err )
49
- if len ( _err . desc ) > 0 {
50
- err = fmt . Errorf ( "%s" , _err . desc [ 0 ]. msg )
48
+ err := & error_ {check : check , code : CannotInferTypeArgs }
49
+ result = checker_infer123 (check , posn , tparams , targs , params , args , true , err )
50
+ for _ , d := range err . desc {
51
+ conf . Error (types. Error { Fset : fset , Pos : d . posn . Pos (), Msg : d . msg } )
51
52
}
52
53
return
53
54
}
@@ -62,6 +63,6 @@ func infer(pkg *Package, posn positioner, tparams []*types.TypeParam, targs []ty
62
63
},
63
64
}
64
65
checker := types .NewChecker (conf , pkg .Fset , pkg .Types , nil )
65
- result , err = checker_infer (checker , posn , tparams , targs , params , args )
66
+ result = checker_infer (checker , conf , pkg . Fset , posn , tparams , targs , params , args )
66
67
return
67
68
}
0 commit comments