Skip to content

Parser should not throw an error if predicate not present#924

Closed
sc07kvm wants to merge 3 commits intoexpr-lang:masterfrom
sc07kvm:no_error_on_unknown_predicate
Closed

Parser should not throw an error if predicate not present#924
sc07kvm wants to merge 3 commits intoexpr-lang:masterfrom
sc07kvm:no_error_on_unknown_predicate

Conversation

@sc07kvm
Copy link

@sc07kvm sc07kvm commented Feb 6, 2026

Context

A change introduced in #842 (related to #841) altered the previous behavior. The earlier behavior was intentional: functions can be provided via env at runtime.

If the following code works:

program, err := expr.Compile(`fn(1)`)
out, err := expr.Run(program, map[string]any{"fn": func(a int) int { return a }})

then this code should work as well:

program, err := expr.Compile(`upper(1)`, expr.DisableBuiltin("upper"))
out, err := expr.Run(program, map[string]any{"upper": func(a int) int { return a }})

Compatibility

#842 also introduced a backward-incompatible behavior in a minor release.

@sc07kvm sc07kvm force-pushed the no_error_on_unknown_predicate branch from c687e09 to 4fbf622 Compare February 7, 2026 08:52
@antonmedv
Copy link
Member

Alright! Nice lets me review the code.

@antonmedv
Copy link
Member

I've reverted the change in 552eb1b

Also added the regression test in 40bda0b (As I think we do not need then amount of tests, I also see repeating tests cases in current PR).

I will release this changes shortly after.

@antonmedv antonmedv closed this Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants