From 6268b61a7d3ea249d5887abd914a70d94e2e2712 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sun, 26 Jan 2025 18:48:53 -0500 Subject: [PATCH] lang: core: Lookup function (with default) can be more precise --- lang/core/lookup_default.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/core/lookup_default.go b/lang/core/lookup_default.go index afe2ec04..0a898a80 100644 --- a/lang/core/lookup_default.go +++ b/lang/core/lookup_default.go @@ -97,8 +97,8 @@ func (obj *LookupDefaultFunc) Build(typ *types.Type) (*types.Type, error) { return nil, fmt.Errorf("input type must be of kind func") } - if len(typ.Ord) < 1 { - return nil, fmt.Errorf("the lookup function needs at least one arg") // actually 2 or 3 + if len(typ.Ord) != 3 { + return nil, fmt.Errorf("the lookup function needs three args") } tListOrMap, exists := typ.Map[typ.Ord[0]] if !exists || tListOrMap == nil {