We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Can I get the pointer value of the struct Env?
Playground:https://go.dev/play/p/WIj3_3NoR2z
package main import ( "fmt" "github.com/expr-lang/expr" ) type ModeEnum int const ( ModeEnumA ModeEnum = 1 ModeEnumB ModeEnum = 2 ) type Env struct { Mode *ModeEnum } func main() { code := `Mode == 1` tmp := ModeEnumA env := map[string]any{ "Mode": &tmp, } program, err := expr.Compile(code, expr.Env(env)) if err != nil { panic(err) } output, err := expr.Run(program, env) if err != nil { panic(err) } fmt.Println(output) }
It prints false, but the expectation is true
Originally posted by @Cassius0924 in #154 (comment)
The text was updated successfully, but these errors were encountered:
If it is repaired, should the Mode be wrapped with an int function? like:
Mode
code := `int(Mode) == 1`
Or will Mode be converted implicitly?
code := `Mode == 1`
Sorry, something went wrong.
Is it possible to add a parameter to control whether implicit conversion is performed?
The problem is with typed int field. Expr see it as an int and assumes no deref is needed. I think we can try to make type checker more advance.
Are you already fixing it?
No branches or pull requests
Playground:https://go.dev/play/p/WIj3_3NoR2z
It prints false, but the expectation is true
Originally posted by @Cassius0924 in #154 (comment)
The text was updated successfully, but these errors were encountered: