diff --git a/cel/cel_test.go b/cel/cel_test.go index b7dd7996..0f8e36a1 100644 --- a/cel/cel_test.go +++ b/cel/cel_test.go @@ -2081,7 +2081,8 @@ func TestDynamicDispatch(t *testing.T) { ), ) out, err := interpret(t, env, ` - [1, 2].first() == 1 + dyn([]).first() == 0 + && [1, 2].first() == 1 && [1.0, 2.0].first() == 1.0 && ["hello", "world"].first() == "hello" && [["hello"], ["world", "!"]].first().first() == "hello" diff --git a/common/decls/decls.go b/common/decls/decls.go index 0284f8db..734ebe57 100644 --- a/common/decls/decls.go +++ b/common/decls/decls.go @@ -243,7 +243,8 @@ func (f *FunctionDecl) Bindings() ([]*functions.Overload, error) { // performs dynamic dispatch to the proper overload based on the argument types. bindings := append([]*functions.Overload{}, overloads...) funcDispatch := func(args ...ref.Val) ref.Val { - for _, o := range f.overloads { + for _, oID := range f.overloadOrdinals { + o := f.overloads[oID] // During dynamic dispatch over multiple functions, signature agreement checks // are preserved in order to assist with the function resolution step. switch len(args) {