-
-
Notifications
You must be signed in to change notification settings - Fork 393
-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Comparison with named integer type fails #632
Labels
Comments
Hey @mbertschler, thanks! I understand this problem. This is actually a Golang related one: https://go.dev/play/p/nYw6xmQ9Ll2 package main
import (
"fmt"
"reflect"
)
type MyInt int
func main() {
var my MyInt = 1
var i int = 1
fmt.Println(my == i) // Compilation will fail.
fmt.Println(reflect.DeepEqual(my, i)) // Will return false.
} Recently in #611 we improved int(Named) == 4 // This will work in Expr. One thing you can do is to write a patcher which will wrap all custom ints with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @antonmedv. Thanks for this amazing library, it is a lot of fun to work with.
After deciding to use it for a new feature with dynamic configuration, we unfortunately ran into some unexpected behavior. The problem is that the expression
Named == 4
returnsfalse
with this environment definition:It seems to be because we use a named type
NamedUint
instead of the basic typeuint32
in our struct.Is this behavior expected?
Reproducing Test
Version:
github.com/expr-lang/expr v1.16.1
The text was updated successfully, but these errors were encountered: