You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that < is translated to > when compiling tengo scripts. I wonder why. This makes BinaryOp() in user defined types to never execute LessEq and Less branch.
For example I have a custom defined type Number, and
Number(14)>12 works because it would invoke Number.BinaryOp that I implemented
Number(12)<14 throws a runtime error, because compiler inverts this to 14>Number(12) in compilation process, and it would invoke Int.BinaryOp and fail.
Are there any special design considerations behind this? Can I simply send a PR to remove this piece of logic in compiler?
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
in compiler.go:
tengo/compiler.go
Lines 144 to 153 in 6fc8053
It seems that
<
is translated to>
when compiling tengo scripts. I wonder why. This makes BinaryOp() in user defined types to never execute LessEq and Less branch.For example I have a custom defined type
Number
, andNumber(14)>12
works because it would invokeNumber.BinaryOp
that I implementedNumber(12)<14
throws a runtime error, because compiler inverts this to14>Number(12)
in compilation process, and it would invokeInt.BinaryOp
and fail.Are there any special design considerations behind this? Can I simply send a PR to remove this piece of logic in compiler?
The text was updated successfully, but these errors were encountered: