Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix doc merge on function decl merge
  • Loading branch information
TristonianJones committed Apr 14, 2025
commit ce4661692b9f9b9412e6d8ef20ff60d030e813a5
7 changes: 5 additions & 2 deletions cel/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,14 @@ func TestEnvToConfig(t *testing.T) {
name: "optional lib - alt last()",
opts: []EnvOption{
OptionalTypes(),
Function("last", MemberOverload("string_last", []*Type{StringType}, StringType)),
Function("last",
FunctionDocs(`return the last value in a list, or last character in a string`),
MemberOverload("string_last", []*Type{StringType}, StringType)),
},
want: env.NewConfig("optional lib - alt last()").
AddExtensions(env.NewExtension("optional", math.MaxUint32)).
AddFunctions(env.NewFunction("last",
AddFunctions(env.NewFunctionWithDoc("last",
`return the last value in a list, or last character in a string`,
env.NewMemberOverload("string_last", env.NewTypeDesc("string"), []*env.TypeDesc{}, env.NewTypeDesc("string")),
)),
},
Expand Down
2 changes: 1 addition & 1 deletion common/decls/decls.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (f *FunctionDecl) Merge(other *FunctionDecl) (*FunctionDecl, error) {
}
// Allow for non-empty overrides of documentation
if len(other.doc) != 0 && f.doc != other.doc {
f.doc = other.doc
merged.doc = other.doc
}
// baseline copy of the overloads and their ordinals
copy(merged.overloadOrdinals, f.overloadOrdinals)
Expand Down