Skip to content

type coercion inconsistently fails depending on order of arguments #114

Description

@klarose

I was surprised to find that a less-than comparison failed between an integer and a float, since I thought I had seen it work earlier. Sure enough, it works if the left hand side is a float, but not if the left hand side is an int.

Example:

# good
python -m celpy -n '4.0 < 10'
true

# bad
python -m celpy -n '10 < 4.0'
ERROR: <input>:1:1 found no matching overload for 'relation_lt' applied to '(<class 'celpy.celtypes.IntType'>, <class 'celpy.celtypes.DoubleType'>)'
    | 10 < 4.0

Both of these work in golang, see cel playground

I expect both statements to properly evaluate. This appears to affect a bunch of other operators (<=, >, >=)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions