From 6a6546db8d3d481cfaf5adcb71c2329d1284cbd3 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sat, 16 Dec 2023 14:25:41 -0500 Subject: [PATCH] lang: ast: Save the non-polyfunc args We probably want to save these args too in case. --- lang/ast/structs.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lang/ast/structs.go b/lang/ast/structs.go index b5181d13bf..c0775eb3be 100644 --- a/lang/ast/structs.go +++ b/lang/ast/structs.go @@ -6984,6 +6984,16 @@ func (obj *ExprFunc) SetType(typ *types.Type) error { } // Cmp doesn't compare arg names. typ = newTyp // check it's compatible down below... + } else { + // Even if it's not polymorphic, we'd like to use the + // real arg names of that function, in case they don't + // get passed through type unification somehow... + // (There can be an AST bug that this would prevent.) + sig := obj.function.Info().Sig + if sig == nil { + return fmt.Errorf("could not read nil expr func sig") + } + typ = sig // check it's compatible down below... } }