Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logical operation against array functions not working as expected in v1.16 #624

Closed
rassakhatsky opened this issue Apr 9, 2024 · 2 comments
Labels

Comments

@rassakhatsky
Copy link

Affected version: 1.16+ (v1.15 works fine).
I'm getting a strange issue while trying to use logical operation against array functions. v1.16 has this issue, v1.15 works fine.
Here is a simple snippet:

	type tag struct {
		Name string
	}

	type item struct {
		Tags []tag
	}

	i := item{
		Tags: []tag{
			{Name: "one"},
			{Name: "two"},
		},
	}

	rule := `[
true && true, 
one(Tags, .Name in ["one"]), 
one(Tags, .Name in ["two"]), 
one(Tags, .Name in ["one"]) && one(Tags, .Name in ["two"])
]`
	resp, err := expr.Eval(rule, i)

Expected Result in v1.15: [true, true, true, true].
Actual Result in v1.16: [true, true, true, false].

@antonmedv
Copy link
Member

I guess this is due to incorrect optimisation in compiler. PTAL @bizywizy

@antonmedv
Copy link
Member

antonmedv commented Apr 10, 2024

Released the fix https://github.com/expr-lang/expr/releases/tag/v1.16.4

Please upgrade to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants