lang: Update the Build signature to return a type

This returns the type with the arg names we'll actually use. This is
helpful so we can pass values to the right places. We have named edges
so you can actually see what's going on.

Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
This commit is contained in:
James Shubin
2023-08-08 21:59:42 -04:00
parent 31c7144fff
commit c06c391461
12 changed files with 283 additions and 153 deletions

View File

@@ -6938,9 +6938,12 @@ func (obj *ExprFunc) SetType(typ *types.Type) error {
if obj.Function != nil {
polyFn, ok := obj.function.(interfaces.PolyFunc) // is it statically polymorphic?
if ok {
if err := polyFn.Build(typ); err != nil {
newTyp, err := polyFn.Build(typ)
if err != nil {
return errwrap.Wrapf(err, "could not build expr func")
}
// Cmp doesn't compare arg names.
typ = newTyp // check it's compatible down below...
}
}