Skip to content

Commit

Permalink
export InferFunc (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc authored Mar 25, 2024
1 parent d3dc787 commit 9bf1e39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ retry:
case *types.Signature:
if t.TypeParams() != nil {
if (flags & instrFlagGopxFunc) == 0 {
rt, err := inferFunc(pkg, fn, t, nil, args, flags)
rt, err := InferFunc(pkg, fn, t, nil, args, flags)
if err != nil {
return nil, pkg.cb.newCodeError(getSrcPos(fn.Src), err.Error())
}
Expand Down
5 changes: 3 additions & 2 deletions typeparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (p *inferFuncType) Instance() *types.Signature {
}

func (p *inferFuncType) InstanceWithArgs(args []*internal.Elem, flags InstrFlags) *types.Signature {
tyRet, err := inferFunc(p.pkg, p.fn, p.typ, p.targs, args, flags)
tyRet, err := InferFunc(p.pkg, p.fn, p.typ, p.targs, args, flags)
if err != nil {
pos := getSrcPos(p.src)
p.pkg.cb.panicCodeErrorf(pos, "%v", err)
Expand Down Expand Up @@ -312,7 +312,8 @@ func checkInferArgs(pkg *Package, fn *internal.Elem, sig *types.Signature, args
return args, nil
}

func inferFunc(pkg *Package, fn *internal.Elem, sig *types.Signature, targs []types.Type, args []*internal.Elem, flags InstrFlags) (types.Type, error) {
// InferFunc attempts to infer and instantiates the generic function instantiation with given func and args.
func InferFunc(pkg *Package, fn *Element, sig *types.Signature, targs []types.Type, args []*Element, flags InstrFlags) (types.Type, error) {
args, err := checkInferArgs(pkg, fn, sig, args, flags)
if err != nil {
return nil, err
Expand Down

0 comments on commit 9bf1e39

Please sign in to comment.